inflections 4.0.1 → 4.1.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
  SHA1:
3
- metadata.gz: de0afd7263d22768a902318aae96d0c16602d3d6
4
- data.tar.gz: 610ddbc4350533bab6e0acc3c3f2b529411abdc9
3
+ metadata.gz: 6aa5e44dd27069a8d1af3ea2a80e26d4e71860f1
4
+ data.tar.gz: 089d07e95a9ecf7f25681542681b08cde9a7ab05
5
5
  SHA512:
6
- metadata.gz: 4ac0437626498016422653003a80d552b027eab3669bfd097a75c3b1fb493f4fd3083751c910fa088591fa2340f3be83e1c69361015c9ba6b6c406868b89dbb5
7
- data.tar.gz: 5be371032c050ee7d4d6169d6350522716e79a6eadc1a2314b2a62af292c230ae3d06e269ebfcc4f9bd52e777b1160ac148bd6ca05eaef7cdcb76e02e03cf678
6
+ metadata.gz: fefbdcae19974cd97502be2f1b8b8e33ae181e4aa87b8ffed623b8c05f485e86ae4840277e4598297d8a7d05f028c51d79b0f43a0134fd782b32cc3e4435272c
7
+ data.tar.gz: f57932c54fe4729bbab0f485b26f93385107dab567001413d46c572ebbe5d04739541bf7a6bbbe483d84a7e72e7fc3014677a4a3d24e03c79a863839342060f0
data/README.markdown CHANGED
@@ -1,10 +1,16 @@
1
1
  # Inflections [![Build Status](https://secure.travis-ci.org/davidcelis/inflections.png)](http://travis-ci.org/davidcelis/inflections)
2
2
 
3
- This gem's purpose is twofold: to remove the cruft from ActiveSupport's inflections and provide a more sane set of defaults for Ruby/Rails applications in English while also providing default rules for other languages.
3
+ Inflections is a repository containing non-English singularization and pluralization rules for Rails, supporting the multilingual ActiveSupport::Inflector in Rails 4.
4
4
 
5
- At the time of this gem's publication, the English list of inflections in ActiveSupport is a mess. It is riddled with special cases such as a special pluralization rule for "octopus" and "virus", even though they follow a regular rule (as octopi and viri are disputed terms). Similar pluralization rules exist for "ox", "quiz", "mouse", "louse", etc.
5
+ ## Languages Currently Supported
6
6
 
7
- Many of the special cases that ActiveSupport defines will not see the light of day in an application. Other rules exist that are actually gramatical exceptions, such as changing "f" to a "v" when encountered at the end of the word (which then requires even more rules to fix special words such as "drive", "safe", "hive", etc.). And, of course, who can forget the special pluralization of "cow" to the archaic term of Scottish origin, "kine" (the plural of "kye")?
7
+ * Spanish (es)
8
+ * French (fr)
9
+ * Kazakh (kk)
10
+ * Norwegian Bokmål (nb)
11
+ * Turkish (tr)
12
+
13
+ If you are fluent in a language not yet included in this gem, _please_ consider creating a list of inflections and submitting a pull request.
8
14
 
9
15
  ## Installation
10
16
 
@@ -44,23 +50,13 @@ end
44
50
 
45
51
  # Rails < 4.0.0
46
52
 
47
- If you're not using ActiveSupport 4, the [multilingual Inflector](http://davidcelis.com/blog/2012/07/31/edge-rails-a-multilingual-inflector/) won't be supported. You should install inflections 3.2.x and you'll have to choose which locale you use by requiring a specific file:
53
+ If you're not using ActiveSupport 4, the [multilingual Inflector](http://davidcel.is/posts/edge-rails-a-multilingual-inflector/) won't be supported. You should install inflections 3.2.x and you'll have to choose which locale you use by requiring a specific file:
48
54
 
49
55
  ```ruby
50
- gem 'inflections', '~> 3.2', require: 'inflections/en'
56
+ gem 'inflections', '~> 3.2', require: 'inflections/es'
51
57
  ```
52
58
 
53
- ## Languages Currently Supported
54
-
55
- * English (en)
56
- * British English (en-GB)
57
- * Spanish (es)
58
- * French (fr)
59
- * Kazakh (kk)
60
- * Norwegian Bokmål (nb)
61
- * Turkish (tr)
62
-
63
- If you are fluent in a language not yet included in this gem, _please_ consider creating a list of inflections and submitting a pull request.
59
+ Note that this will override the default set of English rules that come with Rails. You should do this only if you plan on your constants and code itself not being in English.
64
60
 
65
61
  ## Contributing
66
62
 
data/lib/inflections.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'inflections/en'
2
- require 'inflections/en-GB'
3
1
  require 'inflections/es'
4
2
  require 'inflections/fr'
5
3
  require 'inflections/kk'
@@ -1,7 +1,7 @@
1
1
  module Inflections
2
2
  MAJOR = 4
3
- MINOR = 0
4
- PATCH = 1
3
+ MINOR = 1
4
+ PATCH = 0
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].compact.join '.'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inflections
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Celis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-28 00:00:00.000000000 Z
11
+ date: 2015-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -69,16 +69,12 @@ files:
69
69
  - Rakefile
70
70
  - inflections.gemspec
71
71
  - lib/inflections.rb
72
- - lib/inflections/en-GB.rb
73
- - lib/inflections/en.rb
74
72
  - lib/inflections/es.rb
75
73
  - lib/inflections/fr.rb
76
74
  - lib/inflections/kk.rb
77
75
  - lib/inflections/nb.rb
78
76
  - lib/inflections/tr.rb
79
77
  - lib/inflections/version.rb
80
- - test/en-GB_test.rb
81
- - test/en_test.rb
82
78
  - test/es_test.rb
83
79
  - test/fr_test.rb
84
80
  - test/kk_test.rb
@@ -109,8 +105,6 @@ signing_key:
109
105
  specification_version: 4
110
106
  summary: Sane inflection rules for ActiveSupport.
111
107
  test_files:
112
- - test/en-GB_test.rb
113
- - test/en_test.rb
114
108
  - test/es_test.rb
115
109
  - test/fr_test.rb
116
110
  - test/kk_test.rb
@@ -1,22 +0,0 @@
1
- module Inflections
2
- ActiveSupport::Inflector.inflections(:'en-GB') do |inflect|
3
- inflect.clear
4
-
5
- inflect.plural(/$/, 's')
6
- inflect.plural(/([sxz]|[cs]h)$/i, '\1es')
7
- inflect.plural(/([^aeiouy]o)$/i, '\1es')
8
- inflect.plural(/([^aeiouy])y$/i, '\1ies')
9
-
10
- inflect.singular(/s$/i, '')
11
- inflect.singular(/(ss)$/i, '\1')
12
- inflect.singular(/([sxz]|[cs]h)es$/, '\1')
13
- inflect.singular(/([^aeiouy]o)es$/, '\1')
14
- inflect.singular(/([^aeiouy])ies$/i, '\1y')
15
-
16
- inflect.irregular('child', 'children')
17
- inflect.irregular('person', 'people')
18
- inflect.irregular('self', 'selves')
19
-
20
- inflect.uncountable(%w(series))
21
- end
22
- end
@@ -1,22 +0,0 @@
1
- module Inflections
2
- ActiveSupport::Inflector.inflections(:en) do |inflect|
3
- inflect.clear
4
-
5
- inflect.plural(/$/, 's')
6
- inflect.plural(/([sxz]|[cs]h)$/i, '\1es')
7
- inflect.plural(/([^aeiouy]o)$/i, '\1es')
8
- inflect.plural(/([^aeiouy])y$/i, '\1ies')
9
-
10
- inflect.singular(/s$/i, '')
11
- inflect.singular(/(ss)$/i, '\1')
12
- inflect.singular(/([sxz]|[cs]h)es$/, '\1')
13
- inflect.singular(/([^aeiouy]o)es$/, '\1')
14
- inflect.singular(/([^aeiouy])ies$/i, '\1y')
15
-
16
- inflect.irregular('child', 'children')
17
- inflect.irregular('person', 'people')
18
- inflect.irregular('self', 'selves')
19
-
20
- inflect.uncountable(%w(series))
21
- end
22
- end
data/test/en-GB_test.rb DELETED
@@ -1,70 +0,0 @@
1
- require 'test_helper'
2
- require 'inflections/en-GB'
3
-
4
- class TestEnglishInflections < Minitest::Test
5
- def test_regular_plurals
6
- assert_equal 'dogs', 'dog'.pluralize(:'en-GB')
7
- assert_equal 'dog', 'dogs'.singularize(:'en-GB')
8
-
9
- assert_equal 'days', 'day'.pluralize(:'en-GB')
10
- assert_equal 'day', 'days'.singularize(:'en-GB')
11
-
12
- assert_equal 'tests', 'test'.pluralize(:'en-GB')
13
- assert_equal 'test', 'tests'.singularize(:'en-GB')
14
- end
15
-
16
- def test_sibilant_sounds
17
- assert_equal 'addresses', 'address'.pluralize(:'en-GB')
18
- assert_equal 'address', 'addresses'.singularize(:'en-GB')
19
-
20
- assert_equal 'phases', 'phase'.pluralize(:'en-GB')
21
-
22
- assert_equal 'buzzes', 'buzz'.pluralize(:'en-GB')
23
- assert_equal 'buzz', 'buzzes'.singularize(:'en-GB')
24
-
25
- assert_equal 'boxes', 'box'.pluralize(:'en-GB')
26
- assert_equal 'box', 'boxes'.singularize(:'en-GB')
27
-
28
- assert_equal 'benches', 'bench'.pluralize(:'en-GB')
29
- assert_equal 'bench', 'benches'.singularize(:'en-GB')
30
-
31
- assert_equal 'dishes', 'dish'.pluralize(:'en-GB')
32
- assert_equal 'dish', 'dishes'.singularize(:'en-GB')
33
- end
34
-
35
- def test_oes_rule
36
- assert_equal 'heroes', 'hero'.pluralize(:'en-GB')
37
- assert_equal 'hero', 'heroes'.singularize(:'en-GB')
38
-
39
- assert_equal 'igloos', 'igloo'.pluralize(:'en-GB')
40
- assert_equal 'igloo', 'igloos'.singularize(:'en-GB')
41
- end
42
-
43
- def test_ies_rule
44
- assert_equal 'berries', 'berry'.pluralize(:'en-GB')
45
- assert_equal 'berry', 'berries'.singularize(:'en-GB')
46
-
47
- assert_equal 'days', 'day'.pluralize(:'en-GB')
48
- assert_equal 'day', 'days'.singularize(:'en-GB')
49
- end
50
-
51
- def test_irregulars
52
- assert_equal 'children', 'child'.pluralize(:'en-GB')
53
- assert_equal 'child', 'children'.singularize(:'en-GB')
54
-
55
- assert_equal 'people', 'person'.pluralize(:'en-GB')
56
- assert_equal 'person', 'people'.singularize(:'en-GB')
57
-
58
- assert_equal 'selves', 'self'.pluralize(:'en-GB')
59
- assert_equal 'self', 'selves'.singularize(:'en-GB')
60
- end
61
-
62
- def test_uncountables
63
- assert_equal 'series', 'series'.pluralize(:'en-GB')
64
- assert_equal 'series', 'series'.singularize(:'en-GB')
65
- end
66
-
67
- def test_stupid_inflections_removed
68
- assert_equal 'cows', 'cow'.pluralize(:'en-GB')
69
- end
70
- end
data/test/en_test.rb DELETED
@@ -1,70 +0,0 @@
1
- require 'test_helper'
2
- require 'inflections/en'
3
-
4
- class TestEnglishInflections < Minitest::Test
5
- def test_regular_plurals
6
- assert_equal 'dogs', 'dog'.pluralize(:en)
7
- assert_equal 'dog', 'dogs'.singularize(:en)
8
-
9
- assert_equal 'days', 'day'.pluralize(:en)
10
- assert_equal 'day', 'days'.singularize(:en)
11
-
12
- assert_equal 'tests', 'test'.pluralize(:en)
13
- assert_equal 'test', 'tests'.singularize(:en)
14
- end
15
-
16
- def test_sibilant_sounds
17
- assert_equal 'addresses', 'address'.pluralize(:en)
18
- assert_equal 'address', 'addresses'.singularize(:en)
19
-
20
- assert_equal 'phases', 'phase'.pluralize(:en)
21
-
22
- assert_equal 'buzzes', 'buzz'.pluralize(:en)
23
- assert_equal 'buzz', 'buzzes'.singularize(:en)
24
-
25
- assert_equal 'boxes', 'box'.pluralize(:en)
26
- assert_equal 'box', 'boxes'.singularize(:en)
27
-
28
- assert_equal 'benches', 'bench'.pluralize(:en)
29
- assert_equal 'bench', 'benches'.singularize(:en)
30
-
31
- assert_equal 'dishes', 'dish'.pluralize(:en)
32
- assert_equal 'dish', 'dishes'.singularize(:en)
33
- end
34
-
35
- def test_oes_rule
36
- assert_equal 'heroes', 'hero'.pluralize(:en)
37
- assert_equal 'hero', 'heroes'.singularize(:en)
38
-
39
- assert_equal 'igloos', 'igloo'.pluralize(:en)
40
- assert_equal 'igloo', 'igloos'.singularize(:en)
41
- end
42
-
43
- def test_ies_rule
44
- assert_equal 'berries', 'berry'.pluralize(:en)
45
- assert_equal 'berry', 'berries'.singularize(:en)
46
-
47
- assert_equal 'days', 'day'.pluralize(:en)
48
- assert_equal 'day', 'days'.singularize(:en)
49
- end
50
-
51
- def test_irregulars
52
- assert_equal 'children', 'child'.pluralize(:en)
53
- assert_equal 'child', 'children'.singularize(:en)
54
-
55
- assert_equal 'people', 'person'.pluralize(:en)
56
- assert_equal 'person', 'people'.singularize(:en)
57
-
58
- assert_equal 'selves', 'self'.pluralize(:en)
59
- assert_equal 'self', 'selves'.singularize(:en)
60
- end
61
-
62
- def test_uncountables
63
- assert_equal 'series', 'series'.pluralize(:en)
64
- assert_equal 'series', 'series'.singularize(:en)
65
- end
66
-
67
- def test_stupid_inflections_removed
68
- assert_equal 'cows', 'cow'.pluralize(:en)
69
- end
70
- end