gloo-lang 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f902743811fec6c55772cbf3db6a20dc6d41702334f4089e1c35a05d780ffadc
4
- data.tar.gz: 529e7168fcf0e59d2a90b3bee49c70776763a5019016fa7dec3a77b291360660
3
+ metadata.gz: 6fb484cd2e5faaa8242211141633af07c599895b2eb381ea082eced44d8f34af
4
+ data.tar.gz: fbc868966050778f392b7629febf82a18378a5f6970710d71c9ec4167ffb3a4f
5
5
  SHA512:
6
- metadata.gz: cee004bc20d2fdfd6dafed5bdbd75f17da5883db081236604c9fc64be63d215adad0fd69c5fce71cf387bca5953774ede38bcb2e5f9fd7a92d9bc02a80510921
7
- data.tar.gz: a874636b58d09345512247e2b9d7caf505720b264715122f4e4ec8b1752571eefebe16aebb29df623da77707b0c054031d5aebe19017d5a44e63871f4123868b
6
+ metadata.gz: 1234d3e6413ccd0def80cf023c5d7733e29993cc0025c91b948b875643c640785100a1598207aa5f45381cff46be51db46ec3764d2ca39dd10c47202c388c38b
7
+ data.tar.gz: df8136cd373b4922682779b91c4523976ee3ffcc0c3376fccc160328ec4f6e7163bec0c4cc682c6450e3cde55368fe7b5d9ad6b3afe4e8b674a45cd6dd6d4459
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.2
1
+ 1.2.3
@@ -83,6 +83,44 @@ module GlooLang
83
83
  process_result result
84
84
  end
85
85
 
86
+ # ---------------------------------------------------------------------
87
+ # Show Results
88
+ # ---------------------------------------------------------------------
89
+
90
+ #
91
+ # The first row will be a header row,
92
+ # so if there are exactly 2 rows, then we have only
93
+ # a single row of data.
94
+ #
95
+ def single_row_result?( data )
96
+ return data.count == 2
97
+ end
98
+
99
+ #
100
+ # Show a single row in a vertical, form style view.
101
+ #
102
+ def show_single_row( data )
103
+ head = data[0]
104
+ row = data[1]
105
+
106
+ head.each_with_index do |h, i|
107
+ puts "#{h}: \t #{row[i]}"
108
+ end
109
+ end
110
+
111
+ #
112
+ # Show multiple rows in a table view.
113
+ #
114
+ def show_rows( data )
115
+ data.each_with_index do |row, i|
116
+ # Show header for the first row
117
+ puts row.map { |k, _| k }.join( " \t " ).white if i.zero?
118
+
119
+ # Show the row data
120
+ puts row.map { |_, v| v }.join( " \t " )
121
+ end
122
+ end
123
+
86
124
  # ---------------------------------------------------------------------
87
125
  # Private functions
88
126
  # ---------------------------------------------------------------------
@@ -147,12 +185,10 @@ module GlooLang
147
185
  def show_result( data )
148
186
  return if data.nil?
149
187
 
150
- data.each_with_index do |row, i|
151
- # Show header for the first row
152
- puts row.map { |k, _| k }.join( " \t " ).white if i.zero?
153
-
154
- # Show the row data
155
- puts row.map { |_, v| v }.join( " \t " )
188
+ if single_row_result?( data )
189
+ show_single_row( data )
190
+ else
191
+ show_rows( data )
156
192
  end
157
193
  end
158
194
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gloo-lang
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Crane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-24 00:00:00.000000000 Z
11
+ date: 2022-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler