ordinalize_full 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -4
- data/.travis.yml +3 -2
- data/LICENSE.txt +1 -1
- data/README.md +4 -1
- data/lib/ordinalize_full.rb +6 -1
- data/lib/ordinalize_full/locales/fr.yml +1 -0
- data/ordinalize_full.gemspec +3 -1
- data/spec/ordinalize_full_spec.rb +1 -0
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af2369654eef3567467eea82fbdf6ef6f27d4cd2fb751d69d909dab0d047d2a9
|
4
|
+
data.tar.gz: 6e991c16ef687c7382c5fdcbe948cf6a539c48af9c3e7b1dc02f9a3adf5a7cc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cb46422080c99bab1666eba0ec07c0941461220af3204febd83bb9f25162734f0fef1271118977ea3e797dcbdbe76aa47c7d769568187f81f2ee449a5a46e8d
|
7
|
+
data.tar.gz: 79340703b14bfeedca1edc0b422d57a751b0416a53168ea3abf784a48b8a7dd35526c4d80d4408b9885ac62fe3197f206920f780bb4c5d2b592ef12cfb5102f0
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: 2.6
|
3
|
+
NewCops: enable
|
3
4
|
|
4
5
|
Metrics:
|
5
6
|
Enabled: false
|
@@ -7,9 +8,6 @@ Metrics:
|
|
7
8
|
Layout/AccessModifierIndentation:
|
8
9
|
EnforcedStyle: outdent
|
9
10
|
|
10
|
-
Layout/AlignParameters:
|
11
|
-
Enabled: false
|
12
|
-
|
13
11
|
Layout/CaseIndentation:
|
14
12
|
Enabled: false
|
15
13
|
|
@@ -19,6 +17,9 @@ Layout/EndAlignment:
|
|
19
17
|
Layout/EmptyLinesAroundArguments:
|
20
18
|
Enabled: false
|
21
19
|
|
20
|
+
Layout/LineLength:
|
21
|
+
Enabled: false
|
22
|
+
|
22
23
|
Style/Alias:
|
23
24
|
EnforcedStyle: prefer_alias_method
|
24
25
|
|
data/.travis.yml
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
# OrdinalizeFull
|
1
|
+
# OrdinalizeFull
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/infertux/ordinalize_full.svg?branch=master)](https://travis-ci.org/infertux/ordinalize_full)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/ordinalize_full.svg)](https://badge.fury.io/rb/ordinalize_full)
|
2
5
|
|
3
6
|
Like Rails' [ordinalize](http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-ordinalize) method but with the ability to return the ordinal string spelled out in full words such as _"first"_, _"second"_, _"third"_.
|
4
7
|
|
data/lib/ordinalize_full.rb
CHANGED
@@ -13,9 +13,12 @@ module OrdinalizeFull
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
alias_method :ordinalize_full, \
|
17
16
|
def ordinalize_in_full(gender: :masculine, plurality: :singular)
|
18
17
|
case I18n.locale
|
18
|
+
when :fr
|
19
|
+
value = I18n.t("ordinalize_full.n_#{self}_#{gender}", throw: false, default: "")
|
20
|
+
value = I18n.t("ordinalize_full.n_#{self}", throw: true) if value.empty?
|
21
|
+
value
|
19
22
|
when :es
|
20
23
|
value = I18n.t("ordinalize_full.n_#{self}", throw: false, default: "")
|
21
24
|
|
@@ -38,6 +41,8 @@ module OrdinalizeFull
|
|
38
41
|
raise NotImplementedError, "Unknown locale #{I18n.locale}"
|
39
42
|
end
|
40
43
|
|
44
|
+
alias_method :ordinalize_full, :ordinalize_in_full
|
45
|
+
|
41
46
|
private
|
42
47
|
|
43
48
|
def ordinalize_in_short(gender: :masculine, plurality: :singular)
|
data/ordinalize_full.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "ordinalize_full"
|
8
|
-
spec.version = "1.
|
8
|
+
spec.version = "1.6.0"
|
9
9
|
spec.authors = ["Cédric Félizard"]
|
10
10
|
spec.email = ["cedric@felizard.fr"]
|
11
11
|
spec.summary = "Turns a number into an ordinal string such as first, second, third or 1st, 2nd, 3rd."
|
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.required_ruby_version = ">= 2.6.6"
|
22
|
+
|
21
23
|
spec.add_dependency "i18n", "~> 0.8"
|
22
24
|
|
23
25
|
spec.add_development_dependency "bundler", ">= 1.5"
|
@@ -19,6 +19,7 @@ describe OrdinalizeFull do
|
|
19
19
|
before { I18n.locale = :fr }
|
20
20
|
|
21
21
|
specify { expect(1.ordinalize_in_full).to eq("premier") }
|
22
|
+
specify { expect(1.ordinalize_in_full(gender: :feminine)).to eq("première") }
|
22
23
|
specify { expect(42.ordinalize_in_full).to eq("quarante-deuxième") }
|
23
24
|
end
|
24
25
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ordinalize_full
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cédric Félizard
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -122,7 +122,7 @@ homepage: https://github.com/infertux/ordinalize_full
|
|
122
122
|
licenses:
|
123
123
|
- MIT
|
124
124
|
metadata: {}
|
125
|
-
post_install_message:
|
125
|
+
post_install_message:
|
126
126
|
rdoc_options: []
|
127
127
|
require_paths:
|
128
128
|
- lib
|
@@ -130,16 +130,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
130
|
requirements:
|
131
131
|
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
133
|
+
version: 2.6.6
|
134
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
|
-
|
141
|
-
|
142
|
-
signing_key:
|
140
|
+
rubygems_version: 3.1.4
|
141
|
+
signing_key:
|
143
142
|
specification_version: 4
|
144
143
|
summary: Turns a number into an ordinal string such as first, second, third or 1st,
|
145
144
|
2nd, 3rd.
|