sdbcli 1.4.4 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/sdbcli +1 -1
- data/lib/sdbcli/sdb-runner.rb +18 -4
- metadata +3 -3
data/bin/sdbcli
CHANGED
data/lib/sdbcli/sdb-runner.rb
CHANGED
@@ -26,10 +26,12 @@ class Array
|
|
26
26
|
def as_row
|
27
27
|
row = self.dup
|
28
28
|
|
29
|
-
def row.method_missing(method_name)
|
29
|
+
def row.method_missing(method_name, *args, &block)
|
30
30
|
case method_name.to_s
|
31
31
|
when /itemName/i
|
32
32
|
self[0]
|
33
|
+
when /=\Z/
|
34
|
+
self[1][method_name.to_s.sub(/=\Z/, '')] = (args.length > 2) ? args : args[0]
|
33
35
|
else
|
34
36
|
self[1][method_name.to_s]
|
35
37
|
end
|
@@ -41,10 +43,12 @@ class Array
|
|
41
43
|
def as_row!
|
42
44
|
row = self
|
43
45
|
|
44
|
-
def row.method_missing(method_name)
|
46
|
+
def row.method_missing(method_name, *args, &block)
|
45
47
|
case method_name.to_s
|
46
48
|
when /itemName/i
|
47
49
|
self[0]
|
50
|
+
when /=\Z/
|
51
|
+
self[1][method_name.to_s.sub(/=\Z/, '')] = (args.length > 2) ? args : args[0]
|
48
52
|
else
|
49
53
|
self[1][method_name.to_s]
|
50
54
|
end
|
@@ -56,10 +60,15 @@ class Array
|
|
56
60
|
def as_rows
|
57
61
|
rows = self.dup
|
58
62
|
|
59
|
-
def rows.method_missing(method_name)
|
63
|
+
def rows.method_missing(method_name, *args, &block)
|
60
64
|
case method_name.to_s
|
61
65
|
when /itemName/i
|
62
66
|
self.map {|i| i[0] }
|
67
|
+
when /=\Z/
|
68
|
+
self.each do |i|
|
69
|
+
i[1][method_name.to_s.sub(/=\Z/, '')] = (args.length > 2) ? args : args[0]
|
70
|
+
end
|
71
|
+
self
|
63
72
|
else
|
64
73
|
self.map {|i| i[1][method_name.to_s] }
|
65
74
|
end
|
@@ -71,10 +80,15 @@ class Array
|
|
71
80
|
def as_rows!
|
72
81
|
rows = self
|
73
82
|
|
74
|
-
def rows.method_missing(method_name)
|
83
|
+
def rows.method_missing(method_name, *args, &block)
|
75
84
|
case method_name.to_s
|
76
85
|
when /itemName/i
|
77
86
|
self.map {|i| i[0] }
|
87
|
+
when /=\Z/
|
88
|
+
self.each do |i|
|
89
|
+
i[1][method_name.to_s.sub(/=\Z/, '')] = (args.length > 2) ? args : args[0]
|
90
|
+
end
|
91
|
+
self
|
78
92
|
else
|
79
93
|
self.map {|i| i[1][method_name.to_s] }
|
80
94
|
end
|
metadata
CHANGED