gloo-lang 1.2.1 → 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: 57974f040c6be178fe85ea7aae937a4dcbda5c587e8562337eb3ca0d1350812f
4
- data.tar.gz: ded8003925e5cabece8f655d14724d00c42aedcc2f8f11177af9eb81936a0426
3
+ metadata.gz: 6fb484cd2e5faaa8242211141633af07c599895b2eb381ea082eced44d8f34af
4
+ data.tar.gz: fbc868966050778f392b7629febf82a18378a5f6970710d71c9ec4167ffb3a4f
5
5
  SHA512:
6
- metadata.gz: 5755e06bd81077928a1070904583ce58cb82ea1fcbf19986045c177596cc55df2653d41d35e656bcc12011c553f12d1bf4b105f4c6215271d5dee526c8bc2efb
7
- data.tar.gz: 201d226fa6b5d74de4f1f08848481c7d8f75148a84e068db106d300a3282e8475db648dfec7c64710b94aed3cffdc4e873aa616b6f2610ff16bf82dc01e380bd
6
+ metadata.gz: 1234d3e6413ccd0def80cf023c5d7733e29993cc0025c91b948b875643c640785100a1598207aa5f45381cff46be51db46ec3764d2ca39dd10c47202c388c38b
7
+ data.tar.gz: df8136cd373b4922682779b91c4523976ee3ffcc0c3376fccc160328ec4f6e7163bec0c4cc682c6450e3cde55368fe7b5d9ad6b3afe4e8b674a45cd6dd6d4459
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.2.3
@@ -145,17 +145,37 @@ module GlooLang
145
145
  #
146
146
  # Register a verb after start up.
147
147
  #
148
- def register_verb_post_start( subclass )
149
- # @verb_references << subclass
150
- add_verb subclass
148
+ def register_verb_post_start( verb_class )
149
+ add_verb verb_class
151
150
  end
152
151
 
153
152
  #
154
153
  # Register an object type after start up.
155
154
  #
156
- def register_obj_post_start( subclass )
157
- # @obj_references << subclass
158
- add_object subclass
155
+ def register_obj_post_start( obj_class )
156
+ add_object obj_class
157
+ end
158
+
159
+ #
160
+ # Un-Register a verb.
161
+ #
162
+ def unregister_verb( verb_class )
163
+ @verbs.delete( verb_class.keyword )
164
+ @verbs.delete( verb_class.keyword_shortcut )
165
+
166
+ @keywords.delete( verb_class.keyword )
167
+ @keywords.delete( verb_class.keyword_shortcut )
168
+ end
169
+
170
+ #
171
+ # Un-Register an object.
172
+ #
173
+ def unregister_obj( obj_class )
174
+ @objs.delete( obj_class.typename )
175
+ @objs.delete( obj_class.short_typename )
176
+
177
+ @keywords.delete( obj_class.typename )
178
+ @keywords.delete( obj_class.short_typename )
159
179
  end
160
180
 
161
181
  # ---------------------------------------------------------------------
@@ -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.1
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