Module: BinData::BitFieldFactory
- Included in:
- BinData
- Defined in:
- lib/bindata/bits.rb
Overview
Create classes on demand
Instance Method Summary collapse
Instance Method Details
#const_missing(name) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/bindata/bits.rb', line 68 def const_missing(name) mappings = { /^Bit(\d+)$/ => :big, /^Bit(\d+)le$/ => :little } mappings.each_pair do |regex, endian| if regex =~ name.to_s nbits = $1.to_i return BitField.define_class(nbits, endian) end end super(name) end |