Class: F4R::Record
- Inherits:
-
Object
- Object
- F4R::Record
- Defined in:
- lib/f4r.rb
Overview
Record
is where each data message gets stored including meta data.
Instance Attribute Summary collapse
-
#fields ⇒ Hash
readonly
Where all fields for the specific record get stored.
Instance Method Summary collapse
-
#initialize(message_name) ⇒ Record
constructor
A new instance of Record.
-
#message ⇒ Hash
Global message.
-
#set_field_value(definition, value) ⇒ Object
Sets the
value
attribute for the passed field.
Constructor Details
#initialize(message_name) ⇒ Record
Returns a new instance of Record.
1311 1312 1313 1314 |
# File 'lib/f4r.rb', line 1311 def initialize() @message_name = @fields = {} end |
Instance Attribute Details
#fields ⇒ Hash (readonly)
Where all fields for the specific record get stored
1309 1310 1311 |
# File 'lib/f4r.rb', line 1309 def fields @fields end |
Instance Method Details
#message ⇒ Hash
Global message
1321 1322 1323 |
# File 'lib/f4r.rb', line 1321 def @message ||= GlobalFit..find { |m| m[:name] == @message_name } end |
#set_field_value(definition, value) ⇒ Object
Sets the value
attribute for the passed field.
1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 |
# File 'lib/f4r.rb', line 1331 def set_field_value(definition, value) if fields[definition.name] @fields[definition.name][:value] = value @fields[definition.name][:definition] = definition else @fields[definition.name] = { value: value, base_type: definition.base_type_definition, message_name: definition.[:name], message_number: definition.[:number], definition: definition, properties: definition., } end end |