gloo-lang 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/VERSION +1 -1
- data/lib/gloo_lang/objs/data/query.rb +23 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58d680f352b7415cdb3136da8cc6144d44cc3bb26dcfd4f9313fe70bcdcc2e9e
|
4
|
+
data.tar.gz: 9f3d7d0b2f3766156e02675834fc2449485a1203732f006e27f9946e5d073c75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d79ec414dff160a370d2ad13fde171f945549a5555111ad538afacecf677a194b17326dbd7b7adb2928e563c6490031d993b7fd80ed22cf8f73fa2c2902ec99a
|
7
|
+
data.tar.gz: 60debf4197aab940342ed07ce665c2d7f42a505dab66a36689d95b3f0a793b7114eadbcef34f64bd149770c595c9f95108866d8ed2b603ece61427d13673ede5
|
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.4
|
@@ -93,17 +93,15 @@ module GlooLang
|
|
93
93
|
# a single row of data.
|
94
94
|
#
|
95
95
|
def single_row_result?( data )
|
96
|
-
return data.count ==
|
96
|
+
return data.count == 1
|
97
97
|
end
|
98
98
|
|
99
99
|
#
|
100
100
|
# Show a single row in a vertical, form style view.
|
101
101
|
#
|
102
|
-
def show_single_row( data )
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
head.each_with_index do |h, i|
|
102
|
+
def show_single_row( heads, data )
|
103
|
+
row = data[0]
|
104
|
+
heads.each_with_index do |h, i|
|
107
105
|
puts "#{h}: \t #{row[i]}"
|
108
106
|
end
|
109
107
|
end
|
@@ -111,7 +109,19 @@ module GlooLang
|
|
111
109
|
#
|
112
110
|
# Show multiple rows in a table view.
|
113
111
|
#
|
114
|
-
def show_rows( data )
|
112
|
+
def show_rows( heads, data )
|
113
|
+
puts heads.map { |o| o }.join( " \t " ).white
|
114
|
+
|
115
|
+
data.each do |row|
|
116
|
+
# Show the row data
|
117
|
+
puts row.map { |v| v }.join( " \t " )
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
#
|
122
|
+
# Show multiple rows in a table view.
|
123
|
+
#
|
124
|
+
def show_rows2( data )
|
115
125
|
data.each_with_index do |row, i|
|
116
126
|
# Show header for the first row
|
117
127
|
puts row.map { |k, _| k }.join( " \t " ).white if i.zero?
|
@@ -182,13 +192,15 @@ module GlooLang
|
|
182
192
|
#
|
183
193
|
# Show the result of the query in the console.
|
184
194
|
#
|
185
|
-
def show_result(
|
186
|
-
return if
|
195
|
+
def show_result( result )
|
196
|
+
return if result.nil?
|
187
197
|
|
198
|
+
heads = result[0]
|
199
|
+
data = result[1]
|
188
200
|
if single_row_result?( data )
|
189
|
-
show_single_row( data )
|
201
|
+
show_single_row( heads, data )
|
190
202
|
else
|
191
|
-
show_rows( data )
|
203
|
+
show_rows( heads, data )
|
192
204
|
end
|
193
205
|
end
|
194
206
|
|