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 +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.rubocop.yml +2 -2
- data/humanize.gemspec +2 -3
- data/lib/humanize/locales/fr.rb +11 -3
- data/spec/locales/fr_spec.rb +7 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7a40f302be49db5675f1cfbde2b6a3bfb6246c0807045517fb5f6014bb2b89d
|
4
|
+
data.tar.gz: 6bbffce67dc0543ed68459bf1cdab7437d157a48e56e9d0c9cf034ec4156d7cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c01dccd2f61c3c6fb8836793d01b737b374a2d949467ad16fb81446804434a7efe9367f2215880edb6d6469b52ed50b9ec345f29ac5fdfd65e84b3f081dcc0fc
|
7
|
+
data.tar.gz: b6ccedf9ed4e1468030c68ed7d09d098e6cc9741638323a061357d43e5e8ab2c663933e4223b8a9a464167bf9444dd75c731ef6160bebcf09290a8957f16a978
|
data/.github/workflows/ruby.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
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
|
-
|
13
|
+
Layout/LineLength:
|
14
14
|
Max: 200
|
15
15
|
Exclude:
|
16
16
|
- lib/humanize/locales/constants/*.rb
|
data/humanize.gemspec
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "humanize"
|
3
|
-
s.version = "2.5.
|
3
|
+
s.version = "2.5.1"
|
4
4
|
|
5
|
-
s.required_ruby_version = '>= 2.
|
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'
|
data/lib/humanize/locales/fr.rb
CHANGED
@@ -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
|
29
|
-
|
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
|
data/spec/locales/fr_spec.rb
CHANGED
@@ -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.
|
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:
|
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.
|
156
|
+
version: '2.4'
|
157
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
159
|
- - ">="
|