ruby-factual 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/factual.rb +11 -8
- metadata +3 -3
data/lib/factual.rb
CHANGED
@@ -86,9 +86,11 @@ module Factual
|
|
86
86
|
|
87
87
|
def initialize(table, row_data)
|
88
88
|
@subject_key = row_data[0]
|
89
|
-
|
90
|
-
@
|
91
|
-
@
|
89
|
+
|
90
|
+
@table = table
|
91
|
+
@fields = @table.fields
|
92
|
+
@table_key = @table.key
|
93
|
+
@adapter = @table.adapter
|
92
94
|
|
93
95
|
@subject = []
|
94
96
|
@fields.each_with_index do |f, idx|
|
@@ -99,7 +101,7 @@ module Factual
|
|
99
101
|
@facts_hash = {}
|
100
102
|
@fields.each_with_index do |f, idx|
|
101
103
|
next if f["isPrimary"]
|
102
|
-
@facts_hash[f["field_ref"]] = Fact.new(@
|
104
|
+
@facts_hash[f["field_ref"]] = Fact.new(@table, @subject_key, f, row_data[idx+1])
|
103
105
|
end
|
104
106
|
end
|
105
107
|
|
@@ -116,12 +118,13 @@ module Factual
|
|
116
118
|
class Fact
|
117
119
|
attr_accessor :value, :subject_key, :field, :adapter
|
118
120
|
|
119
|
-
def initialize(
|
121
|
+
def initialize(table, subject_key, field, value)
|
120
122
|
@value = value
|
121
|
-
@subject_key = subject_key
|
122
|
-
@table_key = table_key
|
123
123
|
@field = field
|
124
|
-
@
|
124
|
+
@subject_key = subject_key
|
125
|
+
|
126
|
+
@table_key = table.key
|
127
|
+
@adapter = table.adapter
|
125
128
|
end
|
126
129
|
|
127
130
|
def field_ref
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-factual
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Forrest Cao
|