inflections 3.2.12.20130314 → 3.3.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: c5293b97cee4b290687b85d5d702f262e371603f
4
- data.tar.gz: f597126bf476f1e315086b9f53b0fcfe501b7d06
3
+ metadata.gz: 963ae3a1b63118f9ef1e7126f4ef139b0defbf4b
4
+ data.tar.gz: 6cd643e148a42e3d5dfd0e672d0347c46f292db1
5
5
  SHA512:
6
- metadata.gz: fc17556b22722943c30ed8ede6bee2861d4a677b17e833cbdb04b73f3c77dcbf38071f37a5cf970af6568f684add62e14f0f6b73071a06da446409c1e8f919cb
7
- data.tar.gz: 3701cd02320031edfdc91ebf9602db393ebbf03461b32b40c5ce3ded3a9cba511d43bb47097106f74f350c81563d9cf2d1019980e63acf5dd791e9e460860616
6
+ metadata.gz: b5ee812bbc4eaea06feea9d72714749713f11f5353b9c7dbea92d691d895bdd79d45a6988d383c2f9d0a23ff98473e6bc76bd6b5929691c77a4f9c3bdfdc66fe
7
+ data.tar.gz: 06b8d6cea38a213e3e8d718ab0d870b13900e4a9d2f74377dc89668936b69029ce83ae6abffdf9bff0dd9db5603e4ec20e82db8b08ce04c418dd939afae77391
@@ -1,17 +1,25 @@
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.
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
+
7
+ * English (en)
8
+ * British English (en-GB)
9
+ * Spanish (es)
10
+ * French (fr)
11
+ * Kazakh (kk)
12
+ * Norwegian Bokmål (nb)
13
+ * Turkish (tr)
6
14
 
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")?
15
+ 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
16
 
9
17
  ## Installation
10
18
 
11
19
  Add the following to your application's Gemfile:
12
20
 
13
21
  ```ruby
14
- gem 'inflections'
22
+ gem 'inflections', '~> 3.2'
15
23
  ```
16
24
 
17
25
  And then execute:
@@ -27,15 +35,17 @@ $ bundle
27
35
  If you're using Rails, you're done. The default inflections defined in ActiveSupport will be overwritten, and you can continue to define your own special cases in `config/intializers/inflections.rb`. I18n's default locale (set in `config/application.rb`) will determine which inflections are loaded. If you do not wish to use your default locale, you can require a locale manually in your Gemfile:
28
36
 
29
37
  ```ruby
30
- gem 'inflections', :require => 'inflections/en'
38
+ gem 'inflections', require: 'inflections/es'
31
39
  ```
32
40
 
41
+ 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. If you wish for your code itself to remain in English, it's recommended that you do not include this gem.
42
+
33
43
  ### Otherwise
34
44
 
35
45
  Wherever you need 'em:
36
46
 
37
47
  ```ruby
38
- require 'inflections/en' # Replace 'en' with your preferred locale.
48
+ require 'inflections/es' # Replace 'es' with your preferred locale.
39
49
  ```
40
50
 
41
51
  Define your own defaults as such:
@@ -49,18 +59,6 @@ ActiveSupport::Inflector.inflections do |inflect|
49
59
  end
50
60
  ```
51
61
 
52
- ## Languages Currently Supported
53
-
54
- * English (en)
55
- * British English (en-GB)
56
- * Spanish (es)
57
- * French (fr)
58
- * Kazakh (kk)
59
- * Norwegian Bokmål (nb)
60
- * Turkish (tr)
61
-
62
- 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.
63
-
64
62
  ## Contributing
65
63
 
66
64
  Please note that pull requests for already supported languages will only be accepted for rules that are in error or a potentially missed rule. If your change is an exception to an existing rule, that exception must occur _frequently_ and must involve words used more frequently than the regular plurals. If your change is an irregularity, it must be a word that is arguably _frequently_ encountered in applications that would use ActiveSupport. The default list of inflections is meant to be short.
@@ -3,7 +3,7 @@
3
3
  module Inflections
4
4
  ActiveSupport::Inflector.inflections do |inflect|
5
5
  inflect.clear
6
-
6
+
7
7
  inflect.plural(/$/, 's')
8
8
  inflect.plural(/([^aeéiou])$/i, '\1es')
9
9
  inflect.plural(/([aeiou]s)$/i, '\1')
@@ -16,7 +16,7 @@ module Inflections
16
16
 
17
17
  inflect.singular(/s$/, '')
18
18
  inflect.singular(/es$/, '')
19
-
19
+
20
20
  inflect.irregular('el', 'los')
21
21
  end
22
22
  end
@@ -8,7 +8,6 @@ module Inflections
8
8
  warn "Inflections: no default locale set. Defaulting to English (en)."
9
9
  else
10
10
  warn "Inflections: no support for #{Rails.configuration.i18n.default_locale}. Defaulting to English (en)."
11
- require 'inflections/en'
12
11
  end
13
12
  end
14
13
  end
@@ -1,8 +1,7 @@
1
1
  module Inflections
2
2
  MAJOR = 3
3
- MINOR = 2
4
- PATCH = 12
5
- PRE = 20130314
3
+ MINOR = 3
4
+ PATCH = 0
6
5
 
7
- VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join '.'
6
+ VERSION = [MAJOR, MINOR, PATCH].compact.join '.'
8
7
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inflections
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.12.20130314
4
+ version: 3.3.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: 2013-03-14 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
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 3.2.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.2.0
55
55
  description: A better set of singularization and pluralization rules for Ruby/Rails
@@ -60,8 +60,8 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - .gitignore
64
- - .travis.yml
63
+ - ".gitignore"
64
+ - ".travis.yml"
65
65
  - CHANGELOG.markdown
66
66
  - Gemfile
67
67
  - LICENSE
@@ -69,8 +69,6 @@ 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
@@ -78,8 +76,6 @@ files:
78
76
  - lib/inflections/railtie.rb
79
77
  - lib/inflections/tr.rb
80
78
  - lib/inflections/version.rb
81
- - test/en-GB_test.rb
82
- - test/en_test.rb
83
79
  - test/es_test.rb
84
80
  - test/fr_test.rb
85
81
  - test/kk_test.rb
@@ -95,23 +91,21 @@ require_paths:
95
91
  - lib
96
92
  required_ruby_version: !ruby/object:Gem::Requirement
97
93
  requirements:
98
- - - '>='
94
+ - - ">="
99
95
  - !ruby/object:Gem::Version
100
96
  version: '0'
101
97
  required_rubygems_version: !ruby/object:Gem::Requirement
102
98
  requirements:
103
- - - '>='
99
+ - - ">="
104
100
  - !ruby/object:Gem::Version
105
101
  version: '0'
106
102
  requirements: []
107
103
  rubyforge_project:
108
- rubygems_version: 2.0.2
104
+ rubygems_version: 2.4.5
109
105
  signing_key:
110
106
  specification_version: 4
111
107
  summary: Sane inflection rules for ActiveSupport.
112
108
  test_files:
113
- - test/en-GB_test.rb
114
- - test/en_test.rb
115
109
  - test/es_test.rb
116
110
  - test/fr_test.rb
117
111
  - test/kk_test.rb
@@ -1,22 +0,0 @@
1
- module Inflections
2
- ActiveSupport::Inflector.inflections 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 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,70 +0,0 @@
1
- require 'test_helper'
2
- require 'inflections/en'
3
-
4
- class TestEnglishInflections < MiniTest::Unit::TestCase
5
- def test_regular_plurals
6
- assert_equal 'dogs', 'dog'.pluralize
7
- assert_equal 'dog', 'dogs'.singularize
8
-
9
- assert_equal 'days', 'day'.pluralize
10
- assert_equal 'day', 'days'.singularize
11
-
12
- assert_equal 'tests', 'test'.pluralize
13
- assert_equal 'test', 'tests'.singularize
14
- end
15
-
16
- def test_sibilant_sounds
17
- assert_equal 'addresses', 'address'.pluralize
18
- assert_equal 'address', 'addresses'.singularize
19
-
20
- assert_equal 'phases', 'phase'.pluralize
21
-
22
- assert_equal 'buzzes', 'buzz'.pluralize
23
- assert_equal 'buzz', 'buzzes'.singularize
24
-
25
- assert_equal 'boxes', 'box'.pluralize
26
- assert_equal 'box', 'boxes'.singularize
27
-
28
- assert_equal 'benches', 'bench'.pluralize
29
- assert_equal 'bench', 'benches'.singularize
30
-
31
- assert_equal 'dishes', 'dish'.pluralize
32
- assert_equal 'dish', 'dishes'.singularize
33
- end
34
-
35
- def test_oes_rule
36
- assert_equal 'heroes', 'hero'.pluralize
37
- assert_equal 'hero', 'heroes'.singularize
38
-
39
- assert_equal 'igloos', 'igloo'.pluralize
40
- assert_equal 'igloo', 'igloos'.singularize
41
- end
42
-
43
- def test_ies_rule
44
- assert_equal 'berries', 'berry'.pluralize
45
- assert_equal 'berry', 'berries'.singularize
46
-
47
- assert_equal 'days', 'day'.pluralize
48
- assert_equal 'day', 'days'.singularize
49
- end
50
-
51
- def test_irregulars
52
- assert_equal 'children', 'child'.pluralize
53
- assert_equal 'child', 'children'.singularize
54
-
55
- assert_equal 'people', 'person'.pluralize
56
- assert_equal 'person', 'people'.singularize
57
-
58
- assert_equal 'selves', 'self'.pluralize
59
- assert_equal 'self', 'selves'.singularize
60
- end
61
-
62
- def test_uncountables
63
- assert_equal 'series', 'series'.pluralize
64
- assert_equal 'series', 'series'.singularize
65
- end
66
-
67
- def test_stupid_inflections_removed
68
- assert_equal 'cows', 'cow'.pluralize
69
- end
70
- end
@@ -1,70 +0,0 @@
1
- require 'test_helper'
2
- require 'inflections/en'
3
-
4
- class TestEnglishInflections < MiniTest::Unit::TestCase
5
- def test_regular_plurals
6
- assert_equal 'dogs', 'dog'.pluralize
7
- assert_equal 'dog', 'dogs'.singularize
8
-
9
- assert_equal 'days', 'day'.pluralize
10
- assert_equal 'day', 'days'.singularize
11
-
12
- assert_equal 'tests', 'test'.pluralize
13
- assert_equal 'test', 'tests'.singularize
14
- end
15
-
16
- def test_sibilant_sounds
17
- assert_equal 'addresses', 'address'.pluralize
18
- assert_equal 'address', 'addresses'.singularize
19
-
20
- assert_equal 'phases', 'phase'.pluralize
21
-
22
- assert_equal 'buzzes', 'buzz'.pluralize
23
- assert_equal 'buzz', 'buzzes'.singularize
24
-
25
- assert_equal 'boxes', 'box'.pluralize
26
- assert_equal 'box', 'boxes'.singularize
27
-
28
- assert_equal 'benches', 'bench'.pluralize
29
- assert_equal 'bench', 'benches'.singularize
30
-
31
- assert_equal 'dishes', 'dish'.pluralize
32
- assert_equal 'dish', 'dishes'.singularize
33
- end
34
-
35
- def test_oes_rule
36
- assert_equal 'heroes', 'hero'.pluralize
37
- assert_equal 'hero', 'heroes'.singularize
38
-
39
- assert_equal 'igloos', 'igloo'.pluralize
40
- assert_equal 'igloo', 'igloos'.singularize
41
- end
42
-
43
- def test_ies_rule
44
- assert_equal 'berries', 'berry'.pluralize
45
- assert_equal 'berry', 'berries'.singularize
46
-
47
- assert_equal 'days', 'day'.pluralize
48
- assert_equal 'day', 'days'.singularize
49
- end
50
-
51
- def test_irregulars
52
- assert_equal 'children', 'child'.pluralize
53
- assert_equal 'child', 'children'.singularize
54
-
55
- assert_equal 'people', 'person'.pluralize
56
- assert_equal 'person', 'people'.singularize
57
-
58
- assert_equal 'selves', 'self'.pluralize
59
- assert_equal 'self', 'selves'.singularize
60
- end
61
-
62
- def test_uncountables
63
- assert_equal 'series', 'series'.pluralize
64
- assert_equal 'series', 'series'.singularize
65
- end
66
-
67
- def test_stupid_inflections_removed
68
- assert_equal 'cows', 'cow'.pluralize
69
- end
70
- end