cmdlet 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.builders/.templates/{require_all_cmdlets.rb → cmdlets_require_all.rb} +0 -0
- data/.builders/.templates/handlebars_helper.rb +17 -0
- data/.builders/.templates/handlebars_helper_require_all.rb +5 -0
- data/.builders/.templates/handlebars_helper_spec.rb +26 -0
- data/.builders/boot.rb +4 -0
- data/.builders/data/cmdlets/case.json +291 -0
- data/.builders/director/category_director.rb +6 -1
- data/.builders/director/cmdlet_director.rb +12 -0
- data/.builders/generators/cmdlets/case.rb +169 -0
- data/.builders/generators/cmdlets/comparison.rb +1 -1
- data/CHANGELOG.md +21 -0
- data/lib/cmdlet/_.rb +13 -0
- data/lib/cmdlet/base_cmdlet.rb +1 -1
- data/lib/cmdlet/case/back_slash.rb +16 -0
- data/lib/cmdlet/case/camel.rb +16 -0
- data/lib/cmdlet/case/constant.rb +16 -0
- data/lib/cmdlet/case/dash.rb +16 -0
- data/lib/cmdlet/case/dot.rb +16 -0
- data/lib/cmdlet/case/double_colon.rb +16 -0
- data/lib/cmdlet/case/human.rb +20 -0
- data/lib/cmdlet/case/lamel.rb +16 -0
- data/lib/cmdlet/case/lower.rb +18 -0
- data/lib/cmdlet/case/slash.rb +16 -0
- data/lib/cmdlet/case/snake.rb +16 -0
- data/lib/cmdlet/case/title.rb +21 -0
- data/lib/cmdlet/case/upper.rb +18 -0
- data/lib/cmdlet/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +21 -4
- data/.builders/documents/commands.rb +0 -225
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee471d453193e6c2530ef1728dd97225d9bc1e02f5fefe725e7d1ec4b2d37bff
|
4
|
+
data.tar.gz: c661a29c3a9493d65724c704d2adf0b925236f98179d685067733b7bca0173bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc94edaa20e1dc9ab4ce5b1fc4ec20479fa3f3744ca34ca0c878835d00df85a4fdf7fec4efbf412d26239b98387fec5f1402226278bed4ecea70f8ec0c4db647
|
7
|
+
data.tar.gz: 1cb05dc779c98bb1bed4c86cd7da6755b3e5b864ba9409e5605476ac9e9efe544d2d66a3f48936d358227d2d12a11e215100b2ce169439edef5f940a8d7eee7d
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Handlebarsjs
|
4
|
+
module Helpers
|
5
|
+
# {{cmdlet.category_description}}
|
6
|
+
module {{camel cmdlet.category}}
|
7
|
+
# {{camel cmdlet.name}}: {{cmdlet.description}}
|
8
|
+
class {{camel cmdlet.name}} < Handlebarsjs::BaseHelper
|
9
|
+
register_cmdlet(Cmdlet::{{camel cmdlet.category}}::{{camel cmdlet.name}})
|
10
|
+
|
11
|
+
def to_proc
|
12
|
+
->({{#each cmdlet.parameters}}{{#if ./splat}}{{./splat}}{{/if}}{{./name}}{{#if ./default}} = {{{./default}}}{{/if}}{{#if @last}}{{^}}, {{/if}}{{/each}}, _opts) { wrapper(cmdlet.call({{#each cmdlet.parameters}}{{#if ./splat}}{{./splat}}{{/if}}{{./name}}{{#if @last}}{{^}}, {{/if}}{{/each}})) }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# {{camel cmdlet.name}}: {{cmdlet.description}}
|
4
|
+
RSpec.describe Handlebarsjs::Helpers::{{camel cmdlet.category}}::{{camel cmdlet.name}} do
|
5
|
+
let(:helper_name) { :{{cmdlet.name}} }
|
6
|
+
let(:helper) { described_class.new }
|
7
|
+
let(:handlebars) { Handlebarsjs::Handlebars.new }
|
8
|
+
|
9
|
+
before { handlebars.handlebars_snapshot.add_helper(helper_name, helper) }
|
10
|
+
|
11
|
+
describe '#process_template' do
|
12
|
+
subject { handlebars.process_template(template, data).squish }
|
13
|
+
|
14
|
+
let(:lhs) { nil }
|
15
|
+
let(:rhs) { nil }
|
16
|
+
let(:data) { { lhs: lhs, rhs: rhs } }
|
17
|
+
|
18
|
+
let(:template) do
|
19
|
+
<<~TEXT.chomp
|
20
|
+
{{#if (and lhs rhs)}}
|
21
|
+
{{^}}
|
22
|
+
{{/if}}
|
23
|
+
TEXT
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/.builders/boot.rb
CHANGED
@@ -46,6 +46,7 @@ KConfig.configure(CONFIG_KEY) do |config|
|
|
46
46
|
builder_folder = Dir.pwd
|
47
47
|
base_folder = File.expand_path('../', builder_folder)
|
48
48
|
global_template = File.expand_path('~/dev/kgems/k_templates/templates')
|
49
|
+
handlebars_folder = File.expand_path('~/dev/kgems/handlebarsjs/')
|
49
50
|
|
50
51
|
config.template_folders.add(:global_template , global_template)
|
51
52
|
config.template_folders.add(:template , File.expand_path('.templates', Dir.pwd))
|
@@ -55,6 +56,9 @@ KConfig.configure(CONFIG_KEY) do |config|
|
|
55
56
|
config.target_folders.add(:spec , :app, 'spec/cmdlet')
|
56
57
|
config.target_folders.add(:builder , builder_folder)
|
57
58
|
config.target_folders.add(:builder_data , :builder, 'data')
|
59
|
+
config.target_folders.add(:handlebars , handlebars_folder)
|
60
|
+
config.target_folders.add(:handlebars_lib , :handlebars, 'lib')
|
61
|
+
config.target_folders.add(:handlebars_spec , :handlebars, 'spec')
|
58
62
|
end
|
59
63
|
|
60
64
|
KConfig.configuration(CONFIG_KEY).debug
|
@@ -0,0 +1,291 @@
|
|
1
|
+
{
|
2
|
+
"category_key": "case",
|
3
|
+
"cmdlets": [
|
4
|
+
{
|
5
|
+
"name": "back_slash",
|
6
|
+
"description": "Convert to back slash notation",
|
7
|
+
"result": "value converted to back_slash case",
|
8
|
+
"category": "case",
|
9
|
+
"category_description": "Tokenize and apply case and/or separator",
|
10
|
+
"base_class_require": null,
|
11
|
+
"base_class": null,
|
12
|
+
"parameters": [
|
13
|
+
{
|
14
|
+
"name": "value",
|
15
|
+
"description": "value - to be converted",
|
16
|
+
"splat": null,
|
17
|
+
"default": null,
|
18
|
+
"param_type": "String|Int"
|
19
|
+
}
|
20
|
+
],
|
21
|
+
"examples": [
|
22
|
+
|
23
|
+
],
|
24
|
+
"ruby": " tokenizer.parse(value, preserve_case: true, separator: '\\\\')\n"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"name": "camel",
|
28
|
+
"description": "Camel case the characters in the given 'string'",
|
29
|
+
"result": "value converted to camel case",
|
30
|
+
"category": "case",
|
31
|
+
"category_description": "Tokenize and apply case and/or separator",
|
32
|
+
"base_class_require": null,
|
33
|
+
"base_class": null,
|
34
|
+
"parameters": [
|
35
|
+
{
|
36
|
+
"name": "value",
|
37
|
+
"description": "value - to be converted",
|
38
|
+
"splat": null,
|
39
|
+
"default": null,
|
40
|
+
"param_type": "String|Int"
|
41
|
+
}
|
42
|
+
],
|
43
|
+
"examples": [
|
44
|
+
|
45
|
+
],
|
46
|
+
"ruby": " tokenizer.parse(value).underscore.camelize\n"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"name": "constant",
|
50
|
+
"description": "Constant case the characters in the given 'string'",
|
51
|
+
"result": "value converted to constant case",
|
52
|
+
"category": "case",
|
53
|
+
"category_description": "Tokenize and apply case and/or separator",
|
54
|
+
"base_class_require": null,
|
55
|
+
"base_class": null,
|
56
|
+
"parameters": [
|
57
|
+
{
|
58
|
+
"name": "value",
|
59
|
+
"description": "value - to be converted",
|
60
|
+
"splat": null,
|
61
|
+
"default": null,
|
62
|
+
"param_type": "String|Int"
|
63
|
+
}
|
64
|
+
],
|
65
|
+
"examples": [
|
66
|
+
|
67
|
+
],
|
68
|
+
"ruby": " tokenizer.parse(value, separator: '_').upcase\n"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"name": "dash",
|
72
|
+
"description": "Dash case the characters in the given 'string'",
|
73
|
+
"result": "value converted to dash case",
|
74
|
+
"category": "case",
|
75
|
+
"category_description": "Tokenize and apply case and/or separator",
|
76
|
+
"base_class_require": null,
|
77
|
+
"base_class": null,
|
78
|
+
"parameters": [
|
79
|
+
{
|
80
|
+
"name": "value",
|
81
|
+
"description": "value - to be converted",
|
82
|
+
"splat": null,
|
83
|
+
"default": null,
|
84
|
+
"param_type": "String|Int"
|
85
|
+
}
|
86
|
+
],
|
87
|
+
"examples": [
|
88
|
+
|
89
|
+
],
|
90
|
+
"ruby": " tokenizer.parse(value)\n"
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"name": "dot",
|
94
|
+
"description": "Dot case the characters in the given 'string'",
|
95
|
+
"result": "value converted to dot case",
|
96
|
+
"category": "case",
|
97
|
+
"category_description": "Tokenize and apply case and/or separator",
|
98
|
+
"base_class_require": null,
|
99
|
+
"base_class": null,
|
100
|
+
"parameters": [
|
101
|
+
{
|
102
|
+
"name": "value",
|
103
|
+
"description": "value - to be converted",
|
104
|
+
"splat": null,
|
105
|
+
"default": null,
|
106
|
+
"param_type": "String|Int"
|
107
|
+
}
|
108
|
+
],
|
109
|
+
"examples": [
|
110
|
+
|
111
|
+
],
|
112
|
+
"ruby": " tokenizer.parse(value, separator: '.')\n"
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"name": "double_colon",
|
116
|
+
"description": "Double colon case the characters in the given 'string'",
|
117
|
+
"result": "value converted to double_colon case",
|
118
|
+
"category": "case",
|
119
|
+
"category_description": "Tokenize and apply case and/or separator",
|
120
|
+
"base_class_require": null,
|
121
|
+
"base_class": null,
|
122
|
+
"parameters": [
|
123
|
+
{
|
124
|
+
"name": "value",
|
125
|
+
"description": "value - to be converted",
|
126
|
+
"splat": null,
|
127
|
+
"default": null,
|
128
|
+
"param_type": "String|Int"
|
129
|
+
}
|
130
|
+
],
|
131
|
+
"examples": [
|
132
|
+
|
133
|
+
],
|
134
|
+
"ruby": " tokenizer.parse(value, preserve_case: true, separator: '::')\n"
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"name": "human",
|
138
|
+
"description": "Human case the characters in the given 'string'",
|
139
|
+
"result": "value converted to human case",
|
140
|
+
"category": "case",
|
141
|
+
"category_description": "Tokenize and apply case and/or separator",
|
142
|
+
"base_class_require": null,
|
143
|
+
"base_class": null,
|
144
|
+
"parameters": [
|
145
|
+
{
|
146
|
+
"name": "value",
|
147
|
+
"description": "value - to be converted",
|
148
|
+
"splat": null,
|
149
|
+
"default": null,
|
150
|
+
"param_type": "String|Int"
|
151
|
+
}
|
152
|
+
],
|
153
|
+
"examples": [
|
154
|
+
|
155
|
+
],
|
156
|
+
"ruby": " tokenizer.parse(value,\n separator: ' ',\n preserve_case: true,\n compress_prefix_numerals: false,\n compress_suffix_numerals: false).humanize\n"
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"name": "lamel",
|
160
|
+
"description": "Lower camel case the characters in the given 'string'",
|
161
|
+
"result": "value converted to lower camel case",
|
162
|
+
"category": "case",
|
163
|
+
"category_description": "Tokenize and apply case and/or separator",
|
164
|
+
"base_class_require": null,
|
165
|
+
"base_class": null,
|
166
|
+
"parameters": [
|
167
|
+
{
|
168
|
+
"name": "value",
|
169
|
+
"description": "value - to be converted",
|
170
|
+
"splat": null,
|
171
|
+
"default": null,
|
172
|
+
"param_type": "String|Int"
|
173
|
+
}
|
174
|
+
],
|
175
|
+
"examples": [
|
176
|
+
|
177
|
+
],
|
178
|
+
"ruby": " tokenizer.parse(value, separator: '_').camelize(:lower)\n"
|
179
|
+
},
|
180
|
+
{
|
181
|
+
"name": "lower",
|
182
|
+
"description": "Lower case the characters in the given 'string'",
|
183
|
+
"result": "value converted to lower case",
|
184
|
+
"category": "case",
|
185
|
+
"category_description": "Tokenize and apply case and/or separator",
|
186
|
+
"base_class_require": null,
|
187
|
+
"base_class": null,
|
188
|
+
"parameters": [
|
189
|
+
{
|
190
|
+
"name": "value",
|
191
|
+
"description": "value - to be converted",
|
192
|
+
"splat": null,
|
193
|
+
"default": null,
|
194
|
+
"param_type": "String|Int"
|
195
|
+
}
|
196
|
+
],
|
197
|
+
"examples": [
|
198
|
+
|
199
|
+
],
|
200
|
+
"ruby": " return '' if value.nil?\n\n value.downcase\n"
|
201
|
+
},
|
202
|
+
{
|
203
|
+
"name": "slash",
|
204
|
+
"description": "Slash case the characters in the given 'string'",
|
205
|
+
"result": "value converted to slash case",
|
206
|
+
"category": "case",
|
207
|
+
"category_description": "Tokenize and apply case and/or separator",
|
208
|
+
"base_class_require": null,
|
209
|
+
"base_class": null,
|
210
|
+
"parameters": [
|
211
|
+
{
|
212
|
+
"name": "value",
|
213
|
+
"description": "value - to be converted",
|
214
|
+
"splat": null,
|
215
|
+
"default": null,
|
216
|
+
"param_type": "String|Int"
|
217
|
+
}
|
218
|
+
],
|
219
|
+
"examples": [
|
220
|
+
|
221
|
+
],
|
222
|
+
"ruby": " tokenizer.parse(value, preserve_case: true, separator: '/')\n"
|
223
|
+
},
|
224
|
+
{
|
225
|
+
"name": "snake",
|
226
|
+
"description": "Snake case the characters in the given 'string'",
|
227
|
+
"result": "value converted to snake case",
|
228
|
+
"category": "case",
|
229
|
+
"category_description": "Tokenize and apply case and/or separator",
|
230
|
+
"base_class_require": null,
|
231
|
+
"base_class": null,
|
232
|
+
"parameters": [
|
233
|
+
{
|
234
|
+
"name": "value",
|
235
|
+
"description": "value - to be converted",
|
236
|
+
"splat": null,
|
237
|
+
"default": null,
|
238
|
+
"param_type": "String|Int"
|
239
|
+
}
|
240
|
+
],
|
241
|
+
"examples": [
|
242
|
+
|
243
|
+
],
|
244
|
+
"ruby": " tokenizer.parse(value, separator: '_', forced_separator: true)\n"
|
245
|
+
},
|
246
|
+
{
|
247
|
+
"name": "title",
|
248
|
+
"description": "Title case the characters in the given 'string'",
|
249
|
+
"result": "value converted to title case",
|
250
|
+
"category": "case",
|
251
|
+
"category_description": "Tokenize and apply case and/or separator",
|
252
|
+
"base_class_require": null,
|
253
|
+
"base_class": null,
|
254
|
+
"parameters": [
|
255
|
+
{
|
256
|
+
"name": "value",
|
257
|
+
"description": "value - to be converted",
|
258
|
+
"splat": null,
|
259
|
+
"default": null,
|
260
|
+
"param_type": "String|Int"
|
261
|
+
}
|
262
|
+
],
|
263
|
+
"examples": [
|
264
|
+
|
265
|
+
],
|
266
|
+
"ruby": " tokenizer.parse(value,\n separator: ' ',\n preserve_case: true,\n compress_prefix_numerals: false,\n compress_suffix_numerals: false)\n .titleize\n"
|
267
|
+
},
|
268
|
+
{
|
269
|
+
"name": "upper",
|
270
|
+
"description": "Upper case the characters in the given 'string'",
|
271
|
+
"result": "value converted to upper case",
|
272
|
+
"category": "case",
|
273
|
+
"category_description": "Tokenize and apply case and/or separator",
|
274
|
+
"base_class_require": null,
|
275
|
+
"base_class": null,
|
276
|
+
"parameters": [
|
277
|
+
{
|
278
|
+
"name": "value",
|
279
|
+
"description": "value - to be converted",
|
280
|
+
"splat": null,
|
281
|
+
"default": null,
|
282
|
+
"param_type": "String|Int"
|
283
|
+
}
|
284
|
+
],
|
285
|
+
"examples": [
|
286
|
+
|
287
|
+
],
|
288
|
+
"ruby": " return '' if value.nil?\n\n value.upcase\n"
|
289
|
+
}
|
290
|
+
]
|
291
|
+
}
|
@@ -31,7 +31,12 @@ class CategoryDirector < KDirector::Directors::BaseDirector
|
|
31
31
|
def generate_require_all_cmdlets
|
32
32
|
cd(:lib)
|
33
33
|
add('_.rb',
|
34
|
-
template_file: '
|
34
|
+
template_file: 'cmdlets_require_all.rb',
|
35
|
+
cmdlets: data_access.cmdlet.all_cmdlets)
|
36
|
+
|
37
|
+
cd(:handlebars_lib)
|
38
|
+
add('_.rb',
|
39
|
+
template_file: 'handlebars_helper_require_all.rb',
|
35
40
|
cmdlets: data_access.cmdlet.all_cmdlets)
|
36
41
|
|
37
42
|
end
|
@@ -32,12 +32,20 @@ class CmdletDirector < KDirector::Directors::BaseDirector
|
|
32
32
|
builder.cmdlets.each do |cmdlet|
|
33
33
|
cmdlet_file = "#{cmdlet[:category]}/#{cmdlet[:name]}.rb"
|
34
34
|
cmdlet_spec_file = "#{cmdlet[:category]}/#{cmdlet[:name]}_spec.rb"
|
35
|
+
handlebars_file = "handlebarsjs/helpers/#{cmdlet[:category]}/#{cmdlet[:name]}.rb"
|
36
|
+
handlebars_spec_file = "handlebarsjs/helpers/#{cmdlet[:category]}/#{cmdlet[:name]}_spec.rb"
|
35
37
|
|
36
38
|
cd(:lib)
|
37
39
|
add(cmdlet_file, template_file: 'cmdlet.rb', cmdlet: cmdlet)
|
38
40
|
|
39
41
|
cd(:spec)
|
40
42
|
add(cmdlet_spec_file, template_file: 'cmdlet_spec.rb', cmdlet: cmdlet, on_exist: :skip)
|
43
|
+
|
44
|
+
cd(:handlebars_lib)
|
45
|
+
add(handlebars_file, template_file: 'handlebars_helper.rb', cmdlet: cmdlet)
|
46
|
+
|
47
|
+
cd(:handlebars_spec)
|
48
|
+
add(handlebars_spec_file, template_file: 'handlebars_helper_spec.rb', cmdlet: cmdlet, on_exist: :skip)
|
41
49
|
end
|
42
50
|
|
43
51
|
self
|
@@ -48,6 +56,10 @@ class CmdletDirector < KDirector::Directors::BaseDirector
|
|
48
56
|
k_builder.run_cop('**/*.rb', fix_unsafe: true)
|
49
57
|
end
|
50
58
|
|
59
|
+
Dir.chdir(k_builder.target_folders.get(:handlebars)) do
|
60
|
+
k_builder.run_cop('**/*.rb', fix_unsafe: true)
|
61
|
+
end
|
62
|
+
|
51
63
|
self
|
52
64
|
end
|
53
65
|
|
@@ -0,0 +1,169 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
KManager.action :case_commands do
|
4
|
+
action do
|
5
|
+
CmdletDirector
|
6
|
+
.init(k_builder, category: :case)
|
7
|
+
.cmdlet do
|
8
|
+
name :back_slash
|
9
|
+
description 'Convert to back slash notation'
|
10
|
+
result 'value converted to back_slash case'
|
11
|
+
|
12
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
13
|
+
|
14
|
+
ruby <<-'RUBY'
|
15
|
+
tokenizer.parse(value, preserve_case: true, separator: '\\')
|
16
|
+
RUBY
|
17
|
+
end
|
18
|
+
.cmdlet do
|
19
|
+
name :camel
|
20
|
+
description "Camel case the characters in the given 'string'"
|
21
|
+
result 'value converted to camel case'
|
22
|
+
|
23
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
24
|
+
|
25
|
+
ruby <<-'RUBY'
|
26
|
+
tokenizer.parse(value).underscore.camelize
|
27
|
+
RUBY
|
28
|
+
end
|
29
|
+
.cmdlet do
|
30
|
+
name :constant
|
31
|
+
description "Constant case the characters in the given 'string'"
|
32
|
+
result 'value converted to constant case'
|
33
|
+
|
34
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
35
|
+
|
36
|
+
ruby <<-'RUBY'
|
37
|
+
tokenizer.parse(value, separator: '_').upcase
|
38
|
+
RUBY
|
39
|
+
end
|
40
|
+
.cmdlet do
|
41
|
+
name :dash
|
42
|
+
description "Dash case the characters in the given 'string'"
|
43
|
+
result 'value converted to dash case'
|
44
|
+
|
45
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
46
|
+
|
47
|
+
ruby <<-'RUBY'
|
48
|
+
tokenizer.parse(value)
|
49
|
+
RUBY
|
50
|
+
end
|
51
|
+
.cmdlet do
|
52
|
+
name :dot
|
53
|
+
description "Dot case the characters in the given 'string'"
|
54
|
+
result 'value converted to dot case'
|
55
|
+
|
56
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
57
|
+
|
58
|
+
ruby <<-'RUBY'
|
59
|
+
tokenizer.parse(value, separator: '.')
|
60
|
+
RUBY
|
61
|
+
end
|
62
|
+
.cmdlet do
|
63
|
+
name :double_colon
|
64
|
+
description "Double colon case the characters in the given 'string'"
|
65
|
+
result 'value converted to double_colon case'
|
66
|
+
|
67
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
68
|
+
|
69
|
+
ruby <<-'RUBY'
|
70
|
+
tokenizer.parse(value, preserve_case: true, separator: '::')
|
71
|
+
RUBY
|
72
|
+
end
|
73
|
+
.cmdlet do
|
74
|
+
name :human
|
75
|
+
description "Human case the characters in the given 'string'"
|
76
|
+
result 'value converted to human case'
|
77
|
+
|
78
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
79
|
+
|
80
|
+
ruby <<-'RUBY'
|
81
|
+
tokenizer.parse(value,
|
82
|
+
separator: ' ',
|
83
|
+
preserve_case: true,
|
84
|
+
compress_prefix_numerals: false,
|
85
|
+
compress_suffix_numerals: false).humanize
|
86
|
+
RUBY
|
87
|
+
end
|
88
|
+
.cmdlet do
|
89
|
+
name :lamel
|
90
|
+
description "Lower camel case the characters in the given 'string'"
|
91
|
+
result 'value converted to lower camel case'
|
92
|
+
|
93
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
94
|
+
|
95
|
+
ruby <<-'RUBY'
|
96
|
+
tokenizer.parse(value, separator: '_').camelize(:lower)
|
97
|
+
RUBY
|
98
|
+
end
|
99
|
+
.cmdlet do
|
100
|
+
name :lower
|
101
|
+
description "Lower case the characters in the given 'string'"
|
102
|
+
result 'value converted to lower case'
|
103
|
+
|
104
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
105
|
+
|
106
|
+
ruby <<-'RUBY'
|
107
|
+
return '' if value.nil?
|
108
|
+
|
109
|
+
value.downcase
|
110
|
+
RUBY
|
111
|
+
end
|
112
|
+
.cmdlet do
|
113
|
+
name :slash
|
114
|
+
description "Slash case the characters in the given 'string'"
|
115
|
+
result 'value converted to slash case'
|
116
|
+
|
117
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
118
|
+
|
119
|
+
ruby <<-'RUBY'
|
120
|
+
tokenizer.parse(value, preserve_case: true, separator: '/')
|
121
|
+
RUBY
|
122
|
+
end
|
123
|
+
.cmdlet do
|
124
|
+
name :snake
|
125
|
+
description "Snake case the characters in the given 'string'"
|
126
|
+
result 'value converted to snake case'
|
127
|
+
|
128
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
129
|
+
|
130
|
+
ruby <<-'RUBY'
|
131
|
+
tokenizer.parse(value, separator: '_', forced_separator: true)
|
132
|
+
RUBY
|
133
|
+
end
|
134
|
+
.cmdlet do
|
135
|
+
name :title
|
136
|
+
description "Title case the characters in the given 'string'"
|
137
|
+
result 'value converted to title case'
|
138
|
+
|
139
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
140
|
+
|
141
|
+
ruby <<-'RUBY'
|
142
|
+
tokenizer.parse(value,
|
143
|
+
separator: ' ',
|
144
|
+
preserve_case: true,
|
145
|
+
compress_prefix_numerals: false,
|
146
|
+
compress_suffix_numerals: false)
|
147
|
+
.titleize
|
148
|
+
RUBY
|
149
|
+
end
|
150
|
+
.cmdlet do
|
151
|
+
name :upper
|
152
|
+
description "Upper case the characters in the given 'string'"
|
153
|
+
result 'value converted to upper case'
|
154
|
+
|
155
|
+
parameter :value, 'value - to be converted', param_type: 'String|Int'
|
156
|
+
|
157
|
+
ruby <<-'RUBY'
|
158
|
+
return '' if value.nil?
|
159
|
+
|
160
|
+
value.upcase
|
161
|
+
RUBY
|
162
|
+
end
|
163
|
+
.generate
|
164
|
+
.debug
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# format_as
|
169
|
+
# upper
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
# [0.3.0](https://github.com/klueless-io/cmdlet/compare/v0.2.1...v0.3.0) (2022-07-11)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* update handlebars templates ([599246d](https://github.com/klueless-io/cmdlet/commit/599246d9521381106524c263ccc1c157f093389d))
|
7
|
+
|
8
|
+
## [0.2.1](https://github.com/klueless-io/cmdlet/compare/v0.2.0...v0.2.1) (2022-07-10)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* add case commandlets ([b269f2a](https://github.com/klueless-io/cmdlet/commit/b269f2a770dd698119f360d47756b47bd5b57516))
|
14
|
+
|
15
|
+
# [0.2.0](https://github.com/klueless-io/cmdlet/compare/v0.1.2...v0.2.0) (2022-07-10)
|
16
|
+
|
17
|
+
|
18
|
+
### Features
|
19
|
+
|
20
|
+
* add inflection cmdlets ([55bb73f](https://github.com/klueless-io/cmdlet/commit/55bb73fe3420096a1d4edd85d207529507c088db))
|
21
|
+
|
1
22
|
## [0.1.2](https://github.com/klueless-io/cmdlet/compare/v0.1.1...v0.1.2) (2022-07-10)
|
2
23
|
|
3
24
|
|
data/lib/cmdlet/_.rb
CHANGED
@@ -3,6 +3,19 @@
|
|
3
3
|
require_relative 'array/join'
|
4
4
|
require_relative 'array/join_post'
|
5
5
|
require_relative 'array/join_pre'
|
6
|
+
require_relative 'case/back_slash'
|
7
|
+
require_relative 'case/camel'
|
8
|
+
require_relative 'case/constant'
|
9
|
+
require_relative 'case/dash'
|
10
|
+
require_relative 'case/dot'
|
11
|
+
require_relative 'case/double_colon'
|
12
|
+
require_relative 'case/human'
|
13
|
+
require_relative 'case/lamel'
|
14
|
+
require_relative 'case/lower'
|
15
|
+
require_relative 'case/slash'
|
16
|
+
require_relative 'case/snake'
|
17
|
+
require_relative 'case/title'
|
18
|
+
require_relative 'case/upper'
|
6
19
|
require_relative 'comparison/and'
|
7
20
|
require_relative 'comparison/default'
|
8
21
|
require_relative 'comparison/eq'
|
data/lib/cmdlet/base_cmdlet.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# BackSlash: Convert to back slash notation
|
7
|
+
class BackSlash < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to back_slash case
|
11
|
+
def call(value)
|
12
|
+
tokenizer.parse(value, preserve_case: true, separator: '\\')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# Camel: Camel case the characters in the given 'string'
|
7
|
+
class Camel < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to camel case
|
11
|
+
def call(value)
|
12
|
+
tokenizer.parse(value).underscore.camelize
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# Constant: Constant case the characters in the given 'string'
|
7
|
+
class Constant < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to constant case
|
11
|
+
def call(value)
|
12
|
+
tokenizer.parse(value, separator: '_').upcase
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# Dash: Dash case the characters in the given 'string'
|
7
|
+
class Dash < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to dash case
|
11
|
+
def call(value)
|
12
|
+
tokenizer.parse(value)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# Dot: Dot case the characters in the given 'string'
|
7
|
+
class Dot < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to dot case
|
11
|
+
def call(value)
|
12
|
+
tokenizer.parse(value, separator: '.')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# DoubleColon: Double colon case the characters in the given 'string'
|
7
|
+
class DoubleColon < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to double_colon case
|
11
|
+
def call(value)
|
12
|
+
tokenizer.parse(value, preserve_case: true, separator: '::')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# Human: Human case the characters in the given 'string'
|
7
|
+
class Human < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to human case
|
11
|
+
def call(value)
|
12
|
+
tokenizer.parse(value,
|
13
|
+
separator: ' ',
|
14
|
+
preserve_case: true,
|
15
|
+
compress_prefix_numerals: false,
|
16
|
+
compress_suffix_numerals: false).humanize
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# Lamel: Lower camel case the characters in the given 'string'
|
7
|
+
class Lamel < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to lower camel case
|
11
|
+
def call(value)
|
12
|
+
tokenizer.parse(value, separator: '_').camelize(:lower)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# Lower: Lower case the characters in the given 'string'
|
7
|
+
class Lower < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to lower case
|
11
|
+
def call(value)
|
12
|
+
return '' if value.nil?
|
13
|
+
|
14
|
+
value.downcase
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# Slash: Slash case the characters in the given 'string'
|
7
|
+
class Slash < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to slash case
|
11
|
+
def call(value)
|
12
|
+
tokenizer.parse(value, preserve_case: true, separator: '/')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# Snake: Snake case the characters in the given 'string'
|
7
|
+
class Snake < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to snake case
|
11
|
+
def call(value)
|
12
|
+
tokenizer.parse(value, separator: '_', forced_separator: true)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# Title: Title case the characters in the given 'string'
|
7
|
+
class Title < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to title case
|
11
|
+
def call(value)
|
12
|
+
tokenizer.parse(value,
|
13
|
+
separator: ' ',
|
14
|
+
preserve_case: true,
|
15
|
+
compress_prefix_numerals: false,
|
16
|
+
compress_suffix_numerals: false)
|
17
|
+
.titleize
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Tokenize and apply case and/or separator
|
5
|
+
module Case
|
6
|
+
# Upper: Upper case the characters in the given 'string'
|
7
|
+
class Upper < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value - to be converted
|
10
|
+
# @return [String] value converted to upper case
|
11
|
+
def call(value)
|
12
|
+
return '' if value.nil?
|
13
|
+
|
14
|
+
value.upcase
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/cmdlet/version.rb
CHANGED
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "cmdlet",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.4.0",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "cmdlet",
|
9
|
-
"version": "0.
|
9
|
+
"version": "0.4.0",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.1",
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmdlet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -49,11 +49,15 @@ files:
|
|
49
49
|
- ".builders/.templates/FUNCTIONS.MD"
|
50
50
|
- ".builders/.templates/cmdlet.rb"
|
51
51
|
- ".builders/.templates/cmdlet_spec.rb"
|
52
|
-
- ".builders/.templates/
|
52
|
+
- ".builders/.templates/cmdlets_require_all.rb"
|
53
|
+
- ".builders/.templates/handlebars_helper.rb"
|
54
|
+
- ".builders/.templates/handlebars_helper_require_all.rb"
|
55
|
+
- ".builders/.templates/handlebars_helper_spec.rb"
|
53
56
|
- ".builders/_.rb"
|
54
57
|
- ".builders/boot.rb"
|
55
58
|
- ".builders/data/categories.json"
|
56
59
|
- ".builders/data/cmdlets/array.json"
|
60
|
+
- ".builders/data/cmdlets/case.json"
|
57
61
|
- ".builders/data/cmdlets/comparison.json"
|
58
62
|
- ".builders/data/cmdlets/inflection.json"
|
59
63
|
- ".builders/director/category_builder.rb"
|
@@ -64,13 +68,13 @@ files:
|
|
64
68
|
- ".builders/director/cmdlet_dao.rb"
|
65
69
|
- ".builders/director/cmdlet_director.rb"
|
66
70
|
- ".builders/director/dao.rb"
|
67
|
-
- ".builders/documents/commands.rb"
|
68
71
|
- ".builders/documents/use_cases.rb"
|
69
72
|
- ".builders/documents/x_functions.rb"
|
70
73
|
- ".builders/generators/01-bootstrap.rb"
|
71
74
|
- ".builders/generators/20-categories.rb"
|
72
75
|
- ".builders/generators/30-commands-bak.rb"
|
73
76
|
- ".builders/generators/cmdlets/array.rb"
|
77
|
+
- ".builders/generators/cmdlets/case.rb"
|
74
78
|
- ".builders/generators/cmdlets/comparison.rb"
|
75
79
|
- ".builders/generators/cmdlets/inflection.rb"
|
76
80
|
- ".releaserc.json"
|
@@ -92,6 +96,19 @@ files:
|
|
92
96
|
- lib/cmdlet/array/join_post.rb
|
93
97
|
- lib/cmdlet/array/join_pre.rb
|
94
98
|
- lib/cmdlet/base_cmdlet.rb
|
99
|
+
- lib/cmdlet/case/back_slash.rb
|
100
|
+
- lib/cmdlet/case/camel.rb
|
101
|
+
- lib/cmdlet/case/constant.rb
|
102
|
+
- lib/cmdlet/case/dash.rb
|
103
|
+
- lib/cmdlet/case/dot.rb
|
104
|
+
- lib/cmdlet/case/double_colon.rb
|
105
|
+
- lib/cmdlet/case/human.rb
|
106
|
+
- lib/cmdlet/case/lamel.rb
|
107
|
+
- lib/cmdlet/case/lower.rb
|
108
|
+
- lib/cmdlet/case/slash.rb
|
109
|
+
- lib/cmdlet/case/snake.rb
|
110
|
+
- lib/cmdlet/case/title.rb
|
111
|
+
- lib/cmdlet/case/upper.rb
|
95
112
|
- lib/cmdlet/comparison/and.rb
|
96
113
|
- lib/cmdlet/comparison/default.rb
|
97
114
|
- lib/cmdlet/comparison/eq.rb
|
@@ -1,225 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
def commands
|
4
|
-
return @commands unless @commands.nil?
|
5
|
-
|
6
|
-
result = KDoc.model :document do
|
7
|
-
table :rows do
|
8
|
-
fields :category, :name, :alias, :description, :ruby # , f(name: :params, default: [:value])
|
9
|
-
|
10
|
-
# context 'when array of string' do
|
11
|
-
# let(:value) { %w[the quick fox] }
|
12
|
-
|
13
|
-
# it { is_expected.to eq('the,quick,fox') }
|
14
|
-
# end
|
15
|
-
|
16
|
-
# context 'when array of numbers' do
|
17
|
-
# let(:value) { [1, 2, 3] }
|
18
|
-
|
19
|
-
# it { is_expected.to eq('1,2,3') }
|
20
|
-
# end
|
21
|
-
|
22
|
-
# context 'when array of symbol' do
|
23
|
-
# let(:value) { %i[the quick fox] }
|
24
|
-
|
25
|
-
# it { is_expected.to eq('the,quick,fox') }
|
26
|
-
# end
|
27
|
-
|
28
|
-
row :array , :join , [] , 'join an array of values with separator as a string', <<-'RUBY'
|
29
|
-
return '' if value.nil? || !value.is_a?(Array)
|
30
|
-
values = value.reject(&:blank?)
|
31
|
-
return '' if value.length.zero?
|
32
|
-
|
33
|
-
separator = ','
|
34
|
-
values.join(separator)
|
35
|
-
RUBY
|
36
|
-
|
37
|
-
row :array , :join_pre , [] , 'join an array of values with separator as a string and using the separator at the beginning of string', <<-'RUBY'
|
38
|
-
return '' if value.nil? || !value.is_a?(Array)
|
39
|
-
values = value.reject(&:blank?)
|
40
|
-
return '' if value.length.zero?
|
41
|
-
|
42
|
-
separator = ','
|
43
|
-
"#{separator}#{value.join(separator)}"
|
44
|
-
RUBY
|
45
|
-
|
46
|
-
# row :array , :join_post , [] , "join an array of values with separator as a string and using the separator at the end of string", <<-'RUBY'
|
47
|
-
# return '' if value.nil? || !value.is_a?(Array)
|
48
|
-
# values = value.reject(&:blank?)
|
49
|
-
# return '' if value.length.zero?
|
50
|
-
|
51
|
-
# separator = ','
|
52
|
-
# "#{value.join(separator)}#{separator}"
|
53
|
-
# RUBY
|
54
|
-
|
55
|
-
# row :a_transform , :backslash , [:back_slash] , "convert to back slash notation", <<-'RUBY'
|
56
|
-
# tokenizer.parse(value, preserve_case: true, separator: '\\')
|
57
|
-
# RUBY
|
58
|
-
|
59
|
-
# row :a_transform , :camel , [:upper_camel, :pascal] , "convert to camel notation", <<-'RUBY'
|
60
|
-
# tokenizer.parse(value).underscore.camelize
|
61
|
-
# RUBY
|
62
|
-
|
63
|
-
# row :a_transform , :constant , [:constantize] , "", <<-'RUBY'
|
64
|
-
# tokenizer.parse(value, separator: '_').upcase
|
65
|
-
# RUBY
|
66
|
-
|
67
|
-
# row :a_transform , :dash , [:dasherize] , "convert to dash notation", <<-'RUBY'
|
68
|
-
# tokenizer.parse(value)
|
69
|
-
# RUBY
|
70
|
-
|
71
|
-
# row :a_transform , :dot , [:dotirize] , "", <<-'RUBY'
|
72
|
-
# tokenizer.parse(value, separator: '.')
|
73
|
-
# RUBY
|
74
|
-
|
75
|
-
# row :a_transform , :double_colon , [] , "", <<-'RUBY'
|
76
|
-
# tokenizer.parse(value, preserve_case: true, separator: '::')
|
77
|
-
# RUBY
|
78
|
-
|
79
|
-
# row :a_transform , :lower , [:lowercase, :downcase] , "", <<-'RUBY'
|
80
|
-
# return '' if value.nil?
|
81
|
-
|
82
|
-
# value.downcase
|
83
|
-
# RUBY
|
84
|
-
|
85
|
-
# # row :a_transform , :format_as , [] , "", <<-'RUBY'
|
86
|
-
|
87
|
-
# # RUBY
|
88
|
-
|
89
|
-
# row :a_transform , :proper , [] , "Proper case capitalizes the first letter of ALL words in a string", <<-'RUBY'
|
90
|
-
# tokenizer.parse(value,
|
91
|
-
# separator: ' ',
|
92
|
-
# preserve_case: true,
|
93
|
-
# compress_prefix_numerals: false,
|
94
|
-
# compress_suffix_numerals: false)
|
95
|
-
# .titleize
|
96
|
-
# RUBY
|
97
|
-
|
98
|
-
# row :a_transform , :sentence , [:human, :humanize] , "Upper case for first letter only. Numbers will maintain their spacing", <<-'RUBY'
|
99
|
-
# tokenizer.parse(value,
|
100
|
-
# separator: ' ',
|
101
|
-
# preserve_case: true,
|
102
|
-
# compress_prefix_numerals: false,
|
103
|
-
# compress_suffix_numerals: false)
|
104
|
-
# .humanize
|
105
|
-
# RUBY
|
106
|
-
|
107
|
-
# row :a_transform , :lamel , [:lower_camel] , "", <<-'RUBY'
|
108
|
-
# tokenizer.parse(value, separator: '_').camelize(:lower)
|
109
|
-
# RUBY
|
110
|
-
|
111
|
-
# row :a_transform , :slash , [:forwardslash, :forward_slash] , "", <<-'RUBY'
|
112
|
-
# tokenizer.parse(value, preserve_case: true, separator: '/')
|
113
|
-
# RUBY
|
114
|
-
|
115
|
-
# row :a_transform , :snake , [:snake] , "", <<-'RUBY'
|
116
|
-
# tokenizer.parse(value, separator: '_', forced_separator: true)
|
117
|
-
# RUBY
|
118
|
-
|
119
|
-
# row :a_transform , :title , [:titleize] , "", <<-'RUBY'
|
120
|
-
# tokenizer.parse(value,
|
121
|
-
# separator: ' ',
|
122
|
-
# preserve_case: true,
|
123
|
-
# compress_prefix_numerals: false,
|
124
|
-
# compress_suffix_numerals: false)
|
125
|
-
# .titleize
|
126
|
-
# RUBY
|
127
|
-
|
128
|
-
# row :a_transform , :upper , [:upper_case, :upcase] , "", <<-'RUBY'
|
129
|
-
# return '' if value.nil?
|
130
|
-
|
131
|
-
# value.upcase
|
132
|
-
# RUBY
|
133
|
-
|
134
|
-
# row :a_comparison , :and , [:all] , "", <<-'RUBY'
|
135
|
-
# values.all? { |value| value }
|
136
|
-
# RUBY
|
137
|
-
|
138
|
-
# # DEFAULT does not make sense in comparison
|
139
|
-
# row :a_comparison , :default , [:fallback] , "", <<-'RUBY'
|
140
|
-
# default_value = values[-1]
|
141
|
-
|
142
|
-
# find_value = values[0..-2].find { |value| !value.nil? }
|
143
|
-
|
144
|
-
# find_value || default_value
|
145
|
-
# RUBY
|
146
|
-
|
147
|
-
# row :a_comparison , :eq , [:equal] , "", <<-'RUBY'
|
148
|
-
# lhs = lhs.to_s if lhs.is_a?(Symbol)
|
149
|
-
# rhs = rhs.to_s if rhs.is_a?(Symbol)
|
150
|
-
|
151
|
-
# lhs == rhs
|
152
|
-
# RUBY
|
153
|
-
|
154
|
-
# row :a_comparison , :gt , [] , "", <<-'RUBY'
|
155
|
-
# lhs > rhs
|
156
|
-
# RUBY
|
157
|
-
|
158
|
-
# row :a_comparison , :gte , [] , "", <<-'RUBY'
|
159
|
-
# lhs >= rhs
|
160
|
-
# RUBY
|
161
|
-
|
162
|
-
# row :a_comparison , :lt , [:less_than] , "# Lt: (less than) Block helper that renders a block if `a` is **less than** `b`. If an inverse block is specified it will be rendered when falsy.", <<-'RUBY'
|
163
|
-
# lhs < rhs
|
164
|
-
# RUBY
|
165
|
-
|
166
|
-
# row :a_comparison , :lte , [:less_than_or_equal_to] , "# Lte: (less than or equal to) Block helper that renders a block if `a` is **less than or equal to** `b`. If an inverse block is specified it will be rendered when falsy.", <<-'RUBY'
|
167
|
-
# lhs <= rhs
|
168
|
-
# RUBY
|
169
|
-
|
170
|
-
# row :a_comparison , :ne , [:not_equal] , "# Ne: (not equal) Block helper that renders a block if `a` is **not equal to** `b`. If an inverse block is specified it will be rendered when falsy.", <<-'RUBY'
|
171
|
-
# lhs = lhs.to_s if lhs.is_a?(Symbol)
|
172
|
-
# rhs = rhs.to_s if rhs.is_a?(Symbol)
|
173
|
-
|
174
|
-
# lhs != rhs
|
175
|
-
# RUBY
|
176
|
-
|
177
|
-
# row :a_comparison , :or , [:any] , "", <<-'RUBY'
|
178
|
-
# values.any? { |value| value }
|
179
|
-
# RUBY
|
180
|
-
|
181
|
-
# row :a_inflection , :ordinal , [] , "The suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th", <<-RUBY
|
182
|
-
# return '' if value.nil?
|
183
|
-
|
184
|
-
# value = value.to_i if value.is_a? String
|
185
|
-
|
186
|
-
# value.ordinal
|
187
|
-
# RUBY
|
188
|
-
|
189
|
-
# row :a_inflection , :ordinalize , [] , "Turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.", <<-RUBY
|
190
|
-
# return '' if value.nil?
|
191
|
-
|
192
|
-
# value = value.to_i if value.is_a? String
|
193
|
-
|
194
|
-
# value.ordinalize
|
195
|
-
# RUBY
|
196
|
-
|
197
|
-
# row :a_inflection , :pluralize , [] , "Returns the plural form of the word in the string", <<-RUBY
|
198
|
-
# return '' if value.nil?
|
199
|
-
|
200
|
-
# value = value.to_s if value.is_a?(Symbol)
|
201
|
-
|
202
|
-
# value.pluralize
|
203
|
-
# RUBY
|
204
|
-
|
205
|
-
# row :a_inflection , :pluralize_by_number , [] , "Uses both a word and number to decide if the plural or singular form should be used.", <<-'RUBY'
|
206
|
-
# return '' if value.nil?
|
207
|
-
|
208
|
-
# count = count.to_i if count.is_a? String
|
209
|
-
# format = :word if format.nil?
|
210
|
-
|
211
|
-
# case format.to_sym
|
212
|
-
# when :number_word, :number_and_word
|
213
|
-
# "#{count} #{value.pluralize(count)}"
|
214
|
-
# else # aka :word
|
215
|
-
# value.pluralize(count)
|
216
|
-
# end
|
217
|
-
# RUBY
|
218
|
-
|
219
|
-
# row :a_inflection , :singularize , [] , ""
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
@commands = result.raw_data_struct.rows
|
224
|
-
end
|
225
|
-
@commands = nil
|