Method: OpenC3::StructureItem.from_json

Defined in:
lib/openc3/packets/structure_item.rb

.from_json(hash) ⇒ Object



289
290
291
292
293
294
295
296
297
298
# File 'lib/openc3/packets/structure_item.rb', line 289

def self.from_json(hash)
  # Convert strings to symbols
  endianness = hash['endianness'] ? hash['endianness'].intern : nil
  data_type = hash['data_type'] ? hash['data_type'].intern : nil
  overflow = hash['overflow'] ? hash['overflow'].intern : nil
  si = StructureItem.new(hash['name'], hash['bit_offset'], hash['bit_size'], data_type,
    endianness, hash['array_size'], overflow)
  si.key = hash['key'] || hash['name']
  si
end