cmdlet 0.0.7 → 0.1.2
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/cmdlet.rb +26 -0
- data/.builders/.templates/{command_spec.rb → cmdlet_spec.rb} +4 -4
- data/.builders/.templates/require_all_cmdlets.rb +5 -0
- data/.builders/_.rb +7 -1
- data/.builders/boot.rb +2 -0
- data/.builders/data/categories.json +2 -10
- data/.builders/data/cmdlets/array.json +121 -0
- data/.builders/data/cmdlets/comparison.json +245 -0
- data/.builders/director/category_builder.rb +26 -0
- data/.builders/director/category_dao.rb +38 -0
- data/.builders/director/category_director.rb +24 -10
- data/.builders/director/cmdlet_builder.rb +27 -34
- data/.builders/director/cmdlet_child.rb +16 -44
- data/.builders/director/cmdlet_dao.rb +29 -0
- data/.builders/director/cmdlet_director.rb +37 -13
- data/.builders/director/dao.rb +16 -0
- data/.builders/documents/commands.rb +15 -16
- data/.builders/documents/use_cases.rb +32 -34
- data/.builders/documents/x_functions.rb +7 -10
- data/.builders/generators/01-bootstrap.rb +112 -112
- data/.builders/generators/20-categories.rb +16 -0
- data/.builders/generators/30-commands-bak.rb +53 -0
- data/.builders/generators/cmdlets/array.rb +109 -0
- data/.builders/generators/cmdlets/comparison.rb +164 -0
- data/CHANGELOG.md +22 -0
- data/Guardfile +1 -1
- data/lib/cmdlet/_.rb +14 -0
- data/lib/cmdlet/array/join.rb +8 -10
- data/lib/cmdlet/array/join_post.rb +22 -0
- data/lib/cmdlet/array/join_pre.rb +22 -0
- data/lib/cmdlet/base_cmdlet.rb +17 -0
- data/lib/cmdlet/comparison/and.rb +16 -0
- data/lib/cmdlet/comparison/default.rb +20 -0
- data/lib/cmdlet/comparison/eq.rb +20 -0
- data/lib/cmdlet/comparison/gt.rb +17 -0
- data/lib/cmdlet/comparison/gte.rb +17 -0
- data/lib/cmdlet/comparison/lt.rb +17 -0
- data/lib/cmdlet/comparison/lte.rb +17 -0
- data/lib/cmdlet/comparison/ne.rb +20 -0
- data/lib/cmdlet/comparison/or.rb +16 -0
- data/lib/cmdlet/version.rb +1 -1
- data/lib/cmdlet.rb +3 -0
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +28 -9
- data/.builders/.templates/all_commands.rb +0 -5
- data/.builders/.templates/command.rb +0 -26
- data/.builders/documents/categories.rb +0 -24
- data/.builders/documents/cmdlets.rb +0 -30
- data/.builders/generators/20-commands.rb +0 -54
- data/.builders/generators/25-categories.rb +0 -20
@@ -1,72 +1,65 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class CmdletBuilder < KDirector::Builders::ActionsBuilder
|
4
|
-
attr_reader :
|
5
|
-
# attr_accessor :actions
|
6
|
-
# attr_accessor :last_action
|
4
|
+
attr_reader :current_cmdlet
|
7
5
|
|
8
6
|
def initialize
|
9
7
|
super
|
10
8
|
|
11
|
-
dom[:
|
12
|
-
dom[:
|
13
|
-
# @actions = []
|
14
|
-
# @last_action = {}
|
9
|
+
dom[:category_key] = nil
|
10
|
+
dom[:cmdlets] = []
|
15
11
|
end
|
16
12
|
|
17
|
-
def
|
18
|
-
dom[:
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
def category_key
|
14
|
+
dom[:category_key]
|
15
|
+
end
|
16
|
+
|
17
|
+
def category_key=(value)
|
18
|
+
set(:category_key, value: value)
|
22
19
|
end
|
23
20
|
|
24
|
-
def
|
25
|
-
dom[:
|
21
|
+
def cmdlets
|
22
|
+
dom[:cmdlets]
|
26
23
|
end
|
27
24
|
|
28
|
-
def
|
29
|
-
@
|
30
|
-
dom[:
|
25
|
+
def add_cmdlet
|
26
|
+
@current_cmdlet = new_cmdlet
|
27
|
+
dom[:cmdlets] << current_cmdlet
|
31
28
|
end
|
32
29
|
|
33
|
-
def
|
34
|
-
@
|
30
|
+
def cmdlet_setting(name, value)
|
31
|
+
@current_cmdlet[name] = value
|
35
32
|
end
|
36
33
|
|
37
|
-
def
|
34
|
+
def add_cmdlet_parameter(name, description, **opts)
|
38
35
|
parameter = {
|
39
36
|
name: name,
|
40
|
-
description: description
|
41
|
-
|
42
|
-
}
|
37
|
+
description: description
|
38
|
+
}.merge(opts)
|
43
39
|
|
44
|
-
@
|
40
|
+
@current_cmdlet[:parameters] << parameter
|
45
41
|
end
|
46
42
|
|
47
|
-
def
|
43
|
+
def add_cmdlet_example(value)
|
48
44
|
lines = value.split("\n")
|
49
45
|
value = lines.map { |line| " # #{line.strip}" }.join("\n")
|
50
46
|
|
51
|
-
@
|
47
|
+
@current_cmdlet[:examples] << value
|
52
48
|
end
|
53
49
|
|
54
|
-
|
55
50
|
private
|
56
51
|
|
57
|
-
def
|
52
|
+
def new_cmdlet
|
53
|
+
category = data_access.category.find_category(category_key)
|
54
|
+
|
58
55
|
{
|
59
56
|
name: nil,
|
60
57
|
description: nil,
|
61
58
|
result: nil,
|
62
|
-
category:
|
63
|
-
category_description:
|
59
|
+
category: category[:name],
|
60
|
+
category_description: category[:description],
|
64
61
|
base_class_require: nil,
|
65
62
|
base_class: nil,
|
66
|
-
example_input_value: nil,
|
67
|
-
example_output_value: nil,
|
68
|
-
test_input_value: nil,
|
69
|
-
test_output_value: nil,
|
70
63
|
parameters: [],
|
71
64
|
examples: []
|
72
65
|
}
|
@@ -1,67 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class
|
3
|
+
class CmdletChild < KDirector::Directors::ChildDirector
|
4
4
|
def initialize(parent, **opts)
|
5
5
|
super(parent, **opts)
|
6
6
|
|
7
|
-
builder.
|
8
|
-
|
9
|
-
# defaults = {
|
10
|
-
# repo_name: opts[:repo_name], # || parent.builder.dom&[:github]&[:repo_name]
|
11
|
-
# username: opts[:username] || default_github_username, # || parent.builder.dom&[:github]&[:username]
|
12
|
-
# organization: opts[:organization] # || parent.builder.dom&[:github]&[:organization]
|
13
|
-
# }
|
7
|
+
builder.add_cmdlet
|
14
8
|
end
|
15
9
|
|
16
10
|
def name(value)
|
17
|
-
builder.
|
11
|
+
builder.cmdlet_setting(:name, value)
|
18
12
|
end
|
19
13
|
|
20
14
|
def description(value)
|
21
|
-
builder.
|
15
|
+
builder.cmdlet_setting(:description, value)
|
22
16
|
end
|
23
17
|
|
24
18
|
def result(value)
|
25
|
-
builder.
|
26
|
-
end
|
27
|
-
|
28
|
-
def category(value)
|
29
|
-
builder.helper_setting(:category, value)
|
19
|
+
builder.cmdlet_setting(:result, value)
|
30
20
|
end
|
31
21
|
|
32
|
-
def
|
33
|
-
builder.
|
22
|
+
def ruby(value)
|
23
|
+
builder.cmdlet_setting(:ruby, value)
|
34
24
|
end
|
35
25
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
# def example_input_value(value)
|
45
|
-
# builder.helper_setting(:example_input_value, value)
|
46
|
-
# end
|
47
|
-
|
48
|
-
# def example_output_value(value)
|
49
|
-
# builder.helper_setting(:example_output_value, value)
|
50
|
-
# end
|
51
|
-
|
52
|
-
# def test_input_value(value)
|
53
|
-
# builder.helper_setting(:test_input_value, value)
|
54
|
-
# end
|
55
|
-
|
56
|
-
# def test_output_value(value)
|
57
|
-
# builder.helper_setting(:test_output_value, value)
|
58
|
-
# end
|
59
|
-
|
60
|
-
def parameter(name, description, splat: false)
|
61
|
-
builder.add_helper_parameter(name, description, splat: splat)
|
26
|
+
def parameter(name, description, splat: nil, default: nil, param_type: 'String')
|
27
|
+
builder.add_cmdlet_parameter(
|
28
|
+
name,
|
29
|
+
description,
|
30
|
+
splat: splat,
|
31
|
+
default: default,
|
32
|
+
param_type: param_type
|
33
|
+
)
|
62
34
|
end
|
63
35
|
|
64
36
|
def example(value)
|
65
|
-
builder.
|
37
|
+
builder.add_cmdlet_example(value)
|
66
38
|
end
|
67
39
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CmdletDao
|
4
|
+
attr_reader :k_builder
|
5
|
+
|
6
|
+
def initialize(k_builder)
|
7
|
+
@k_builder = k_builder
|
8
|
+
end
|
9
|
+
|
10
|
+
def all_cmdlets
|
11
|
+
data_access
|
12
|
+
.category
|
13
|
+
.categories.flat_map { |category| read_cmdlets(category[:name]) }
|
14
|
+
.compact
|
15
|
+
.uniq
|
16
|
+
.sort_by { |r| [r[:category], r[:name]] }
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def read_cmdlets(category_name)
|
22
|
+
file_name = k_builder.target_folders.join(:builder_data, 'cmdlets', "#{category_name}.json")
|
23
|
+
|
24
|
+
return JSON.parse(File.read(file_name), symbolize_names: true)[:cmdlets] if File.exist?(file_name)
|
25
|
+
|
26
|
+
puts "Cmdlet file #{file_name} not found"
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
end
|
@@ -1,36 +1,60 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class CmdletDirector < KDirector::Directors::BaseDirector
|
4
|
-
|
4
|
+
defaults(builder_type: CmdletBuilder, on_exist: :write, on_action: :execute)
|
5
5
|
|
6
|
-
def
|
7
|
-
|
6
|
+
def initialize(k_builder, builder, **opts)
|
7
|
+
super(k_builder, builder, **opts)
|
8
|
+
|
9
|
+
builder.category_key = opts[:category] || :unknown
|
10
|
+
end
|
11
|
+
|
12
|
+
def cmdlet(**opts, &block)
|
13
|
+
cmdlet = CmdletChild.new(self, **opts)
|
14
|
+
cmdlet.instance_eval(&block) if block_given?
|
8
15
|
|
9
16
|
self
|
10
17
|
end
|
11
18
|
|
12
|
-
def
|
13
|
-
|
14
|
-
|
19
|
+
def categories
|
20
|
+
data_access.category_director.categories
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate
|
24
|
+
build_cmdlets
|
25
|
+
save_cmdlets
|
26
|
+
run_cop
|
15
27
|
|
16
28
|
self
|
17
29
|
end
|
18
30
|
|
19
|
-
def
|
20
|
-
builder.
|
31
|
+
def build_cmdlets
|
32
|
+
builder.cmdlets.each do |cmdlet|
|
33
|
+
cmdlet_file = "#{cmdlet[:category]}/#{cmdlet[:name]}.rb"
|
34
|
+
cmdlet_spec_file = "#{cmdlet[:category]}/#{cmdlet[:name]}_spec.rb"
|
35
|
+
|
21
36
|
cd(:lib)
|
22
|
-
add(
|
37
|
+
add(cmdlet_file, template_file: 'cmdlet.rb', cmdlet: cmdlet)
|
23
38
|
|
24
39
|
cd(:spec)
|
25
|
-
add(
|
40
|
+
add(cmdlet_spec_file, template_file: 'cmdlet_spec.rb', cmdlet: cmdlet, on_exist: :skip)
|
26
41
|
end
|
27
42
|
|
28
43
|
self
|
29
44
|
end
|
30
45
|
|
31
|
-
def
|
46
|
+
def run_cop
|
47
|
+
Dir.chdir(k_builder.target_folders.get(:app)) do
|
48
|
+
k_builder.run_cop('**/*.rb', fix_unsafe: true)
|
49
|
+
end
|
50
|
+
|
51
|
+
self
|
52
|
+
end
|
53
|
+
|
54
|
+
def save_cmdlets
|
32
55
|
cd(:builder_data)
|
33
|
-
add(
|
34
|
-
|
56
|
+
add("cmdlets/#{builder.category_key}.json", content: builder.to_json)
|
57
|
+
|
58
|
+
self
|
35
59
|
end
|
36
60
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
def data_access
|
4
|
+
@data_access ||= Dao.new(k_builder)
|
5
|
+
end
|
6
|
+
|
7
|
+
class Dao
|
8
|
+
attr_reader :k_builder
|
9
|
+
attr_reader :category
|
10
|
+
attr_reader :cmdlet
|
11
|
+
|
12
|
+
def initialize(k_builder)
|
13
|
+
@category = CategoryDao.new(k_builder)
|
14
|
+
@cmdlet = CmdletDao.new(k_builder)
|
15
|
+
end
|
16
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
def commands
|
2
4
|
return @commands unless @commands.nil?
|
3
|
-
|
5
|
+
|
4
6
|
result = KDoc.model :document do
|
5
7
|
table :rows do
|
6
8
|
fields :category, :name, :alias, :description, :ruby # , f(name: :params, default: [:value])
|
@@ -23,7 +25,7 @@ def commands
|
|
23
25
|
# it { is_expected.to eq('the,quick,fox') }
|
24
26
|
# end
|
25
27
|
|
26
|
-
row :array , :join , [] ,
|
28
|
+
row :array , :join , [] , 'join an array of values with separator as a string', <<-'RUBY'
|
27
29
|
return '' if value.nil? || !value.is_a?(Array)
|
28
30
|
values = value.reject(&:blank?)
|
29
31
|
return '' if value.length.zero?
|
@@ -32,14 +34,14 @@ def commands
|
|
32
34
|
values.join(separator)
|
33
35
|
RUBY
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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?
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
separator = ','
|
43
|
+
"#{separator}#{value.join(separator)}"
|
44
|
+
RUBY
|
43
45
|
|
44
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'
|
45
47
|
# return '' if value.nil? || !value.is_a?(Array)
|
@@ -59,7 +61,7 @@ def commands
|
|
59
61
|
# RUBY
|
60
62
|
|
61
63
|
# row :a_transform , :constant , [:constantize] , "", <<-'RUBY'
|
62
|
-
# tokenizer.parse(value, separator: '_').upcase
|
64
|
+
# tokenizer.parse(value, separator: '_').upcase
|
63
65
|
# RUBY
|
64
66
|
|
65
67
|
# row :a_transform , :dash , [:dasherize] , "convert to dash notation", <<-'RUBY'
|
@@ -81,7 +83,7 @@ def commands
|
|
81
83
|
# RUBY
|
82
84
|
|
83
85
|
# # row :a_transform , :format_as , [] , "", <<-'RUBY'
|
84
|
-
|
86
|
+
|
85
87
|
# # RUBY
|
86
88
|
|
87
89
|
# row :a_transform , :proper , [] , "Proper case capitalizes the first letter of ALL words in a string", <<-'RUBY'
|
@@ -129,7 +131,6 @@ def commands
|
|
129
131
|
# value.upcase
|
130
132
|
# RUBY
|
131
133
|
|
132
|
-
|
133
134
|
# row :a_comparison , :and , [:all] , "", <<-'RUBY'
|
134
135
|
# values.all? { |value| value }
|
135
136
|
# RUBY
|
@@ -177,8 +178,6 @@ def commands
|
|
177
178
|
# values.any? { |value| value }
|
178
179
|
# RUBY
|
179
180
|
|
180
|
-
|
181
|
-
|
182
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
|
183
182
|
# return '' if value.nil?
|
184
183
|
|
@@ -216,11 +215,11 @@ def commands
|
|
216
215
|
# value.pluralize(count)
|
217
216
|
# end
|
218
217
|
# RUBY
|
219
|
-
|
218
|
+
|
220
219
|
# row :a_inflection , :singularize , [] , ""
|
221
220
|
end
|
222
221
|
end
|
223
|
-
|
222
|
+
|
224
223
|
@commands = result.raw_data_struct.rows
|
225
224
|
end
|
226
225
|
@commands = nil
|
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
def use_cases
|
2
4
|
return @use_cases unless @use_cases.nil?
|
3
|
-
|
4
|
-
result = KDoc.model :document do
|
5
5
|
|
6
|
+
result = KDoc.model :document do
|
6
7
|
# table :inputs do
|
7
8
|
# fields :name, :value
|
8
9
|
|
@@ -18,9 +19,9 @@ def use_cases
|
|
18
19
|
|
19
20
|
# end
|
20
21
|
|
21
|
-
sentence1 =
|
22
|
-
sentence2 =
|
23
|
-
text1 =
|
22
|
+
sentence1 = 'The quick brown fox, jumped over the lazy dog'
|
23
|
+
sentence2 = 'coyote and the acme company'
|
24
|
+
text1 = 'the Quick brown Fox 99'
|
24
25
|
|
25
26
|
table :rows do
|
26
27
|
# fields :category, :function, :input, :commands, :expected_value
|
@@ -62,37 +63,36 @@ def use_cases
|
|
62
63
|
row :a_transform , :title , [text1] , 'The Quick Brown Fox 99'
|
63
64
|
row :a_transform , :title , [sentence1] , 'The Quick Brown Fox Jumped over the Lazy Dog'
|
64
65
|
row :a_transform , :upper , [text1] , 'THE QUICK BROWN FOX 99'
|
65
|
-
|
66
66
|
|
67
67
|
row :a_comparison , :and , [nil, nil] , false
|
68
68
|
row :a_comparison , :and , ['data', nil] , false
|
69
69
|
row :a_comparison , :and , [nil, 'data'] , false
|
70
|
-
row :a_comparison , :and , [
|
71
|
-
row :a_comparison , :and , [
|
70
|
+
row :a_comparison , :and , %w[data data] , true
|
71
|
+
row :a_comparison , :and , %w[aaa bbb] , true
|
72
72
|
|
73
73
|
# DEFAULT does not make sense in comparison
|
74
|
-
row :a_comparison , :default , [nil, 'happy'] ,
|
75
|
-
row :a_comparison , :default , [
|
76
|
-
row :a_comparison , :default , [nil, nil, nil, nil, 'david'] ,
|
77
|
-
row :a_comparison , :default , ['', 'happy'] ,
|
74
|
+
row :a_comparison , :default , [nil, 'happy'] , 'happy'
|
75
|
+
row :a_comparison , :default , %w[sad happy] , 'sad'
|
76
|
+
row :a_comparison , :default , [nil, nil, nil, nil, 'david'] , 'david'
|
77
|
+
row :a_comparison , :default , ['', 'happy'] , 'happy'
|
78
78
|
|
79
79
|
# type: :strict, :equiv, :cast, :insensitive
|
80
|
-
row :a_comparison , :eq , [111, '111'
|
81
|
-
row :a_comparison , :eq , [111, 111.0
|
82
|
-
row :a_comparison , :eq , [
|
83
|
-
row :a_comparison , :eq , [
|
84
|
-
row :a_comparison , :eq , [
|
80
|
+
row :a_comparison , :eq , [111, '111'], false
|
81
|
+
row :a_comparison , :eq , [111, 111.0], false
|
82
|
+
row :a_comparison , :eq , %w[aaa aaa], true
|
83
|
+
row :a_comparison , :eq , %w[aaa bbb], false
|
84
|
+
row :a_comparison , :eq , %i[aaa aaa] , true
|
85
85
|
row :a_comparison , :eq , ['aaa', :aaa] , false
|
86
|
-
row :a_comparison , :eq , [
|
87
|
-
row :a_comparison , :eq , [
|
86
|
+
row :a_comparison , :eq , %w[aaa bbb], false
|
87
|
+
row :a_comparison , :eq , %w[aaa AAA], false
|
88
88
|
|
89
89
|
row :a_comparison , :gt , [2, 1] , true
|
90
90
|
row :a_comparison , :gt , [2, 2] , false
|
91
|
-
|
91
|
+
|
92
92
|
row :a_comparison , :gte , [1, 2] , false
|
93
93
|
row :a_comparison , :gte , [1, 1] , true
|
94
94
|
row :a_comparison , :gte , [2, 1] , true
|
95
|
-
|
95
|
+
|
96
96
|
row :a_comparison , :lt , [1, 2] , true
|
97
97
|
row :a_comparison , :lt , [2, 1] , false
|
98
98
|
|
@@ -102,16 +102,15 @@ def use_cases
|
|
102
102
|
|
103
103
|
row :a_comparison , :ne , [1, 2] , true
|
104
104
|
row :a_comparison , :ne , [1, 1] , false
|
105
|
-
|
105
|
+
|
106
106
|
row :a_comparison , :or , [nil, nil] , false
|
107
107
|
row :a_comparison , :or , ['data', nil] , true
|
108
108
|
row :a_comparison , :or , [nil, 'data'] , true
|
109
|
-
row :a_comparison , :or , [
|
110
|
-
row :a_comparison , :or , [
|
109
|
+
row :a_comparison , :or , %w[data data] , true
|
110
|
+
row :a_comparison , :or , %w[aaa bbb] , true
|
111
111
|
# row :text1 , %i[backslash] , 'the\quick\brown\fox99'
|
112
112
|
# row :text1 , %i[camel] , 'TheQuickBrownFox99'
|
113
113
|
|
114
|
-
|
115
114
|
# row :sentence3 , %i[plural] , "jumped over the lazy dogs"
|
116
115
|
# row :title , %i[plural] , "Account Categories"
|
117
116
|
# row :sentence1 , %i[dash] , "The-quick-brown-fox-jumped-over-the-lazy-dog"
|
@@ -120,17 +119,16 @@ def use_cases
|
|
120
119
|
# row :bsb_account , %i[lower snake] , "abc_123"
|
121
120
|
# row :bsb_account , %i[slash] , "ABC/123"
|
122
121
|
end
|
123
|
-
|
124
122
|
end
|
125
|
-
|
123
|
+
|
126
124
|
@use_cases = result.raw_data_struct.rows
|
127
125
|
end
|
128
126
|
@use_cases = nil
|
129
127
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
128
|
+
# def self.camel_case(string, tokenizer = PreservePrefixedUnderscoreTokenizer.new)
|
129
|
+
# # DAVE INPUT 9 Oct 21 from lucky_case play
|
130
|
+
# # dependency injection: to use enhanced tokenizer
|
131
|
+
# a = split_case_string string
|
132
|
+
# converted = ([a[0]] + a[1..-1].map { |e| capital e }).join('')
|
133
|
+
# tokenizer.parse(converted)
|
134
|
+
# end
|
@@ -1,6 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
def category_blueprint
|
3
|
-
|
4
4
|
fn_builder
|
5
5
|
.init
|
6
6
|
.category(:array , active: 0 , title: 'Array' , description: 'Functions for working with Array')
|
@@ -24,11 +24,9 @@ def category_blueprint
|
|
24
24
|
.category(:regex , active: 0 , title: 'Regex' , description: 'Functions for working with Regex')
|
25
25
|
.category(:string , active: 0 , title: 'String' , description: 'Functions for working with String')
|
26
26
|
.category(:url , active: 0 , title: 'Url' , description: 'Functions for working with Url')
|
27
|
-
|
28
27
|
end
|
29
28
|
|
30
29
|
def function_blueprint
|
31
|
-
|
32
30
|
fn_builder
|
33
31
|
.init
|
34
32
|
.for_category(:array)
|
@@ -41,11 +39,11 @@ def function_blueprint
|
|
41
39
|
.for_category(:html)
|
42
40
|
.for_category(:i18n)
|
43
41
|
.for_category(:inflection)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
42
|
+
.function(:ordinal)
|
43
|
+
.function(:ordinalize)
|
44
|
+
.function(:pluralize_by_number)
|
45
|
+
.function(:pluralize)
|
46
|
+
.function(:singularize)
|
49
47
|
.for_category(:logging)
|
50
48
|
.for_category(:markdown)
|
51
49
|
.for_category(:match)
|
@@ -57,10 +55,9 @@ def function_blueprint
|
|
57
55
|
.for_category(:regex)
|
58
56
|
.for_category(:string)
|
59
57
|
.for_category(:url)
|
60
|
-
|
61
58
|
end
|
62
59
|
|
63
60
|
# {{arrayify}}
|
64
61
|
# Cast the given value to an array.
|
65
62
|
# {{before}}
|
66
|
-
# Return all of the items in the collection before the specified count. Opposite of after.
|
63
|
+
# Return all of the items in the collection before the specified count. Opposite of after.
|