cmdlet 0.4.2 → 0.5.0

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: 9506e418e3b6a429f7022e585a9252980d9bb6ddc7a5e63701ffb3500b9388b8
4
- data.tar.gz: '038194a239e9fb9e440c6c697837a6172a2aa3cee05ae6f5b6a2104a231a84bc'
3
+ metadata.gz: 7858e7b563b7d8fd9ed449d7d21de54eb3f6816d28fb80b7b46deb2fb741101f
4
+ data.tar.gz: 92fddb23254d18ab8ae07bfe00c3d593845aadd1243e2e1bfee78b7c4628da4b
5
5
  SHA512:
6
- metadata.gz: e8743f42553160393f595bc4d10b486d8ff35faf28b391346cc471ccc11bb4a351552a59f4bc9fa46778d90cc78caae8ea6e255564010303160216309869b757
7
- data.tar.gz: d38a9aba60cad381a19bbf1da0e81423116fb07c6ef4e7a88fb1105ea6c6e1522e5be782bd20e6b34a95d98d13f216da2e41895b68f54213423400be90be50c0
6
+ metadata.gz: 40f58c5d81364fb22291245f52b5b6e457f123f36a88a380e74e9dd7102d42f2afd63888165570849a4502dd25a90fd37bca056decaa3edd4de0f3747d9500e9
7
+ data.tar.gz: c3058b29c7f59a80c2bc58f237a05fa8a690b5d7444a04afcd8451919476d0dc0c00c599425502971b9e2b55c6166b51cef3049d6aca903700329b66997cff38
@@ -68,8 +68,8 @@
68
68
  "ruby": " return '' if value.nil?\n\n value = value.to_s if value.is_a?(Symbol)\n\n value.pluralize\n"
69
69
  },
70
70
  {
71
- "name": "pluralize_by_number",
72
- "description": "Returns the plural form of the word based on a count",
71
+ "name": "pluralize_number",
72
+ "description": "Returns the plural form of the word based on a count in the format \"categories\"",
73
73
  "result": "value and number are used to calculate plural/singular form",
74
74
  "category": "inflection",
75
75
  "category_description": "Inflection handling routines, eg. pluralize, singular, ordinalize",
@@ -89,19 +89,12 @@
89
89
  "splat": null,
90
90
  "default": null,
91
91
  "param_type": "Int"
92
- },
93
- {
94
- "name": "format",
95
- "description": "(Optional) what format should output be. :word, :number_word",
96
- "splat": null,
97
- "default": null,
98
- "param_type": "String"
99
92
  }
100
93
  ],
101
94
  "examples": [
102
95
 
103
96
  ],
104
- "ruby": " return '' if value.nil?\n\n count = count.to_i if count.is_a? String\n format = :word if format.nil?\n\n case format.to_sym\n when :number_word, :number_and_word\n \"#{count} #{value.pluralize(count)}\"\n else # aka :word\n value.pluralize(count)\n end\n"
97
+ "ruby": " return '' if value.nil?\n\n count = count.to_i if count.is_a? String\n\n value.pluralize(count)\n"
105
98
  },
106
99
  {
107
100
  "name": "pluralize_number_word",
@@ -50,26 +50,19 @@ KManager.action :inflection_commands do
50
50
  RUBY
51
51
  end
52
52
  .cmdlet do
53
- name :pluralize_by_number
54
- description 'Returns the plural form of the word based on a count'
53
+ name :pluralize_number
54
+ description 'Returns the plural form of the word based on a count in the format "categories"'
55
55
  result 'value and number are used to calculate plural/singular form'
56
56
 
57
57
  parameter :value, 'value - value to pluralize', param_type: 'String'
58
58
  parameter :count, 'count used to determine pluralization', param_type: 'Int'
59
- parameter :format, '(Optional) what format should output be. :word, :number_word'
60
-
59
+
61
60
  ruby <<-'RUBY'
62
61
  return '' if value.nil?
63
62
 
64
63
  count = count.to_i if count.is_a? String
65
- format = :word if format.nil?
66
-
67
- case format.to_sym
68
- when :number_word, :number_and_word
69
- "#{count} #{value.pluralize(count)}"
70
- else # aka :word
71
- value.pluralize(count)
72
- end
64
+
65
+ value.pluralize(count)
73
66
  RUBY
74
67
  end
75
68
  .cmdlet do
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.4.2](https://github.com/klueless-io/cmdlet/compare/v0.4.1...v0.4.2) (2022-07-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add inflection: pluralize_number and pluralize_number_word ([a97bbe1](https://github.com/klueless-io/cmdlet/commit/a97bbe1a7960d1dfc26ee37dbf93804ba571fe0d))
7
+
1
8
  ## [0.4.1](https://github.com/klueless-io/cmdlet/compare/v0.4.0...v0.4.1) (2022-07-12)
2
9
 
3
10
 
data/lib/cmdlet/_.rb CHANGED
@@ -28,7 +28,6 @@ require_relative 'comparison/or'
28
28
  require_relative 'inflection/ordinal'
29
29
  require_relative 'inflection/ordinalize'
30
30
  require_relative 'inflection/pluralize'
31
- require_relative 'inflection/pluralize_by_number'
32
31
  require_relative 'inflection/pluralize_number'
33
32
  require_relative 'inflection/pluralize_number_word'
34
33
  require_relative 'inflection/singularize'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cmdlet
4
- VERSION = '0.4.2'
4
+ VERSION = '0.5.0'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "cmdlet",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "cmdlet",
9
- "version": "0.4.2",
9
+ "version": "0.5.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmdlet",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Cmdlet provides a set of functions (wrapped in the command pattern) that perform simple actions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmdlet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -122,7 +122,6 @@ files:
122
122
  - lib/cmdlet/inflection/ordinal.rb
123
123
  - lib/cmdlet/inflection/ordinalize.rb
124
124
  - lib/cmdlet/inflection/pluralize.rb
125
- - lib/cmdlet/inflection/pluralize_by_number.rb
126
125
  - lib/cmdlet/inflection/pluralize_number.rb
127
126
  - lib/cmdlet/inflection/pluralize_number_word.rb
128
127
  - lib/cmdlet/inflection/singularize.rb
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Cmdlet
4
- # Inflection handling routines, eg. pluralize, singular, ordinalize
5
- module Inflection
6
- # PluralizeByNumber: Returns the plural form of the word based on a count
7
- class PluralizeByNumber < Cmdlet::BaseCmdlet
8
- #
9
- # @param [String] value - value - value to pluralize
10
- # @param [Int] count - count used to determine pluralization
11
- # @param [String] format - (Optional) what format should output be. :word, :number_word
12
- # @return [String] value and number are used to calculate plural/singular form
13
- def call(value, count, format)
14
- return '' if value.nil?
15
-
16
- count = count.to_i if count.is_a? String
17
- format = :word if format.nil?
18
-
19
- case format.to_sym
20
- when :number_word, :number_and_word
21
- "#{count} #{value.pluralize(count)}"
22
- else # aka :word
23
- value.pluralize(count)
24
- end
25
- end
26
- end
27
- end
28
- end