Class: Factual::Row
- Inherits:
-
Object
- Object
- Factual::Row
- Defined in:
- lib/factual.rb
Instance Attribute Summary collapse
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#subject_key ⇒ Object
Returns the value of attribute subject_key.
Instance Method Summary collapse
- #[](field_ref) ⇒ Object
-
#initialize(table, row_data) ⇒ Row
constructor
A new instance of Row.
-
#input(values) ⇒ Object
TODO.
Constructor Details
#initialize(table, row_data) ⇒ Row
Returns a new instance of Row.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/factual.rb', line 87 def initialize(table, row_data) @subject_key = row_data[0] @table = table @fields = @table.fields @table_key = @table.key @adapter = @table.adapter @subject = [] @fields.each_with_index do |f, idx| next unless f["isPrimary"] @subject << row_data[idx+1] end @facts_hash = {} @fields.each_with_index do |f, idx| next if f["isPrimary"] @facts_hash[f["field_ref"]] = Fact.new(@table, @subject_key, f, row_data[idx+1]) end end |
Instance Attribute Details
#subject ⇒ Object
Returns the value of attribute subject.
85 86 87 |
# File 'lib/factual.rb', line 85 def subject @subject end |
#subject_key ⇒ Object
Returns the value of attribute subject_key.
85 86 87 |
# File 'lib/factual.rb', line 85 def subject_key @subject_key end |
Instance Method Details
#[](field_ref) ⇒ Object
108 109 110 |
# File 'lib/factual.rb', line 108 def [](field_ref) @facts_hash[field_ref] end |
#input(values) ⇒ Object
TODO
113 114 115 |
# File 'lib/factual.rb', line 113 def input(values) end |