humanize 2.5.0 → 2.5.1

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: 238c8473d0d8ce9c6aef43453a46bf6e8751fd9c425a9b24abe5268e120ae491
4
- data.tar.gz: d305845dc8e91b63b5b004c8d797c8e4b1f14995c20d4a490c66d61b1e57d07f
3
+ metadata.gz: a7a40f302be49db5675f1cfbde2b6a3bfb6246c0807045517fb5f6014bb2b89d
4
+ data.tar.gz: 6bbffce67dc0543ed68459bf1cdab7437d157a48e56e9d0c9cf034ec4156d7cc
5
5
  SHA512:
6
- metadata.gz: 511c850b9ef98cce32abe87f7ead90a9b235672cd45f1fd871ac06c5247cf63577a0013a13d06474395723582c9a5f9b01227a13f2bca6a1c157d3e5b9e3cf00
7
- data.tar.gz: 330401654240ba9aaeaca94c3d888db1c44884fa0a0945999c6670db6302252f12cd13b0ab516573d0a44511725104418b65feb224c70472937f5d9d2bfc482f
6
+ metadata.gz: c01dccd2f61c3c6fb8836793d01b737b374a2d949467ad16fb81446804434a7efe9367f2215880edb6d6469b52ed50b9ec345f29ac5fdfd65e84b3f081dcc0fc
7
+ data.tar.gz: b6ccedf9ed4e1468030c68ed7d09d098e6cc9741638323a061357d43e5e8ab2c663933e4223b8a9a464167bf9444dd75c731ef6160bebcf09290a8957f16a978
@@ -1,6 +1,6 @@
1
1
  name: Ruby
2
2
 
3
- on: [push]
3
+ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  build:
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.3
2
+ TargetRubyVersion: 2.4
3
3
 
4
4
  Style/StringLiterals:
5
5
  Enabled: false
@@ -10,7 +10,7 @@ Style/FrozenStringLiteralComment:
10
10
  Style/Documentation:
11
11
  Enabled: false
12
12
 
13
- Metrics/LineLength:
13
+ Layout/LineLength:
14
14
  Max: 200
15
15
  Exclude:
16
16
  - lib/humanize/locales/constants/*.rb
@@ -1,15 +1,14 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "humanize"
3
- s.version = "2.5.0"
3
+ s.version = "2.5.1"
4
4
 
5
- s.required_ruby_version = '>= 2.3'
5
+ s.required_ruby_version = '>= 2.4'
6
6
  s.require_paths = ["lib"]
7
7
  s.authors = ["Jack Chen", "Ryan Bigg"]
8
8
  s.email = "me@ryanbigg.com"
9
9
  s.files = `git ls-files`.split($/)
10
10
  s.test_files = s.files.grep(%r{^(spec)/})
11
11
  s.homepage = "https://github.com/radar/humanize"
12
- s.rubygems_version = "2.5.1"
13
12
  s.summary = "Extension to Numeric to humanize numbers"
14
13
 
15
14
  s.add_development_dependency 'mutant'
@@ -8,7 +8,7 @@ module Humanize
8
8
  until number.zero?
9
9
  number, remainder = number.divmod(1000)
10
10
  unless remainder.zero?
11
- add_grouping(parts, iteration)
11
+ add_grouping(parts, iteration, remainder)
12
12
 
13
13
  parts << SUB_ONE_GROUPING[remainder] unless exactly_one_thousand?(remainder, parts)
14
14
  end
@@ -25,8 +25,16 @@ module Humanize
25
25
  remainder == 1 && parts.last.to_s.strip == 'mille'
26
26
  end
27
27
 
28
- def add_grouping(parts, iteration)
29
- grouping = LOTS[iteration]
28
+ def plural_for_lots(remainder, word, iteration)
29
+ if remainder > 1 && iteration >= 2
30
+ "#{word}s"
31
+ else
32
+ word
33
+ end
34
+ end
35
+
36
+ def add_grouping(parts, iteration, remainder)
37
+ grouping = plural_for_lots(remainder, LOTS[iteration], iteration)
30
38
  return unless grouping
31
39
 
32
40
  parts << grouping
@@ -11,7 +11,13 @@ RSpec.describe Humanize, "fr locale" do
11
11
  [8.15, 'huit virgule un cinq'],
12
12
  [1002, 'mille deux'],
13
13
  [2001, 'deux mille un'],
14
- [10_000, 'dix mille']
14
+ [10_000, 'dix mille'],
15
+ [1_000_000, "un million"],
16
+ [2_000_000, "deux millions"],
17
+ [5_000_000, "cinq millions"],
18
+ [1_000_000_000, "un milliard"],
19
+ [2_000_000_000, "deux milliards"],
20
+ [5_000_000_000, "cinq milliards"]
15
21
  ]
16
22
 
17
23
  tests.each do |num, output|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humanize
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Chen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-10-23 00:00:00.000000000 Z
12
+ date: 2021-01-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mutant
@@ -153,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
153
  requirements:
154
154
  - - ">="
155
155
  - !ruby/object:Gem::Version
156
- version: '2.3'
156
+ version: '2.4'
157
157
  required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  requirements:
159
159
  - - ">="