adacosta-labilerecord 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/labilerecord.rb +5 -5
- metadata +1 -1
data/lib/labilerecord.rb
CHANGED
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
4
|
module LabileRecord
|
5
|
-
VERSION = '0.0.
|
5
|
+
VERSION = '0.0.7'
|
6
6
|
require 'pg'
|
7
7
|
|
8
8
|
class Base
|
@@ -30,6 +30,7 @@ module LabileRecord
|
|
30
30
|
@result = connection.exec(@string)
|
31
31
|
parse_fields
|
32
32
|
parse_result_data
|
33
|
+
self
|
33
34
|
end
|
34
35
|
|
35
36
|
def parse_result_data
|
@@ -42,7 +43,7 @@ module LabileRecord
|
|
42
43
|
columns.each do |column_name|
|
43
44
|
row << @result[row_index][column_name]
|
44
45
|
end
|
45
|
-
|
46
|
+
send "<<", row
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
@@ -55,7 +56,6 @@ module LabileRecord
|
|
55
56
|
field_type_name = type[0][type.fields[0]].to_s
|
56
57
|
@fields << Field.new( field_name, field_type_name, pg_field_type_id)
|
57
58
|
end
|
58
|
-
@fields
|
59
59
|
end
|
60
60
|
|
61
61
|
def connection
|
@@ -80,11 +80,11 @@ module LabileRecord
|
|
80
80
|
@fields = fields
|
81
81
|
end
|
82
82
|
|
83
|
-
def method_missing(meth
|
83
|
+
def method_missing(meth, *args)
|
84
84
|
if ( field_index = @fields.index(meth.id2name) )
|
85
85
|
at field_index
|
86
86
|
else
|
87
|
-
super
|
87
|
+
super(meth, *args)
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|