Class: BinParser

Inherits:
Object
  • Object
show all
Defined in:
lib/binp.rb

Class Method Summary collapse

Class Method Details

.parse(uint8_array, config) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/binp.rb', line 5

def self.parse(uint8_array, config)
flatten_config = config.flat_map { |e|
  new_e = e.clone
  # ビットフラグかどうかを確認
  if e['type'] == BinParserElement::Type::FLAGS
    new_e = BinParserElement.get_flags(uint8_array, e)
  else
    new_e['value'] = BinParserElement.get_value(uint8_array, e['offset'], e['size'], e['type'], e['endianness'], e['value_label'])
  end
  new_e
}
end