Class: RFilemaker::Record
- Inherits:
-
SpecialHash
- Object
- Hash
- SpecialHash
- RFilemaker::Record
- Defined in:
- lib/rfilemaker/record.rb
Overview
Represents a Row in the Filemaker database, as a plain Hash
Instance Attribute Summary collapse
-
#mod_id ⇒ Object
readonly
Modification id from Filemaker.
-
#record_id ⇒ Object
readonly
Record id from Filemaker.
Instance Method Summary collapse
-
#initialize(row, fields) ⇒ Record
constructor
A new instance of Record.
Methods inherited from SpecialHash
Constructor Details
#initialize(row, fields) ⇒ Record
Returns a new instance of Record.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rfilemaker/record.rb', line 10 def initialize(row, fields) @record_id = row[:record_id] @mod_id = row[:mod_id] fields.each_with_index do |field, index| data = row[:columns][index] if data.is_a?(Array) self[field.name] = [] data.each { |d| self[field.name] << field.coerce(d) } else self[field.name] = field.coerce(data) end end freeze end |
Instance Attribute Details
#mod_id ⇒ Object (readonly)
Modification id from Filemaker
8 9 10 |
# File 'lib/rfilemaker/record.rb', line 8 def mod_id @mod_id end |
#record_id ⇒ Object (readonly)
Record id from Filemaker
5 6 7 |
# File 'lib/rfilemaker/record.rb', line 5 def record_id @record_id end |