inflections 3.2.12.20130305 → 3.2.12.20130314

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: 97ccb5336adb5e35bedba3fe99972cea8e7f2443
4
- data.tar.gz: 55d6db3746e2f6ecd428759f438073385216ec67
3
+ metadata.gz: c5293b97cee4b290687b85d5d702f262e371603f
4
+ data.tar.gz: f597126bf476f1e315086b9f53b0fcfe501b7d06
5
5
  SHA512:
6
- metadata.gz: 7dcf62242f4378c6af3c55b14110ed74b28fe64ee97f45033c01485d841e3b3803ee315ebcd99c791a9a46e703610b3cf850bf7301fdd6d8c7bbc90995a10346
7
- data.tar.gz: 973ffb7d802d8b34847ba1dbc8665c024f62dd77363a3c5ab9838421f7b048e0eef7d0af1559ba8c87ac108c0a0fed7c2223ae2eca98557c400ca53966f59de2
6
+ metadata.gz: fc17556b22722943c30ed8ede6bee2861d4a677b17e833cbdb04b73f3c77dcbf38071f37a5cf970af6568f684add62e14f0f6b73071a06da446409c1e8f919cb
7
+ data.tar.gz: 3701cd02320031edfdc91ebf9602db393ebbf03461b32b40c5ce3ded3a9cba511d43bb47097106f74f350c81563d9cf2d1019980e63acf5dd791e9e460860616
data/CHANGELOG.markdown CHANGED
@@ -1,5 +1,9 @@
1
- 3.2.12.20130305 (Current release)
1
+ 3.2.12.20130314 (Current release)
2
2
  =================================
3
+ * Support for French (thanks to [Olivier Laviale](https://github.com/olvlvl) of [ICanBoogie](https://github.com/ICanBoogie/Inflector))
4
+
5
+ 3.2.12.20130305
6
+ ===============
3
7
  * Fix #9 - a bug that was causing all strings to pluralize and singularize in Turkish.
4
8
 
5
9
  3.2.12
data/README.markdown CHANGED
@@ -54,6 +54,7 @@ end
54
54
  * English (en)
55
55
  * British English (en-GB)
56
56
  * Spanish (es)
57
+ * French (fr)
57
58
  * Kazakh (kk)
58
59
  * Norwegian Bokmål (nb)
59
60
  * Turkish (tr)
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+ #
3
+ # These rules come from a port of ActiveSupport's Inflector to PHP:
4
+ # https://github.com/ICanBoogie/Inflector/blob/master/lib/inflections/fr.php
5
+
6
+ module Inflections
7
+ ActiveSupport::Inflector.inflections do |inflect|
8
+ inflect.clear
9
+
10
+ inflect.plural(/$/, 's')
11
+ inflect.singular(/s$/, '')
12
+
13
+ inflect.plural(/(bijou|caillou|chou|genou|hibou|joujou|pou|au|eu|eau)$/, '\1x')
14
+ inflect.singular(/(bijou|caillou|chou|genou|hibou|joujou|pou|au|eu|eau)x$/, '\1')
15
+
16
+ inflect.plural(/(bleu|émeu|landau|lieu|pneu|sarrau)$/, '\1s')
17
+ inflect.plural(/al$/, 'aux')
18
+ inflect.plural(/ail$/, 'ails')
19
+ inflect.singular(/(journ|chev)aux$/, '\1al')
20
+ inflect.singular(/ails$/, 'ail')
21
+
22
+ inflect.plural(/(b|cor|ém|gemm|soupir|trav|vant|vitr)ail$/, '\1aux')
23
+ inflect.singular(/(b|cor|ém|gemm|soupir|trav|vant|vitr)aux$/, '\1ail')
24
+
25
+ inflect.plural(/(s|x|z)$/, '\1')
26
+
27
+ inflect.irregular('monsieur', 'messieurs')
28
+ inflect.irregular('madame', 'mesdames')
29
+ inflect.irregular('mademoiselle', 'mesdemoiselles')
30
+ end
31
+ end
@@ -2,7 +2,7 @@ module Inflections
2
2
  MAJOR = 3
3
3
  MINOR = 2
4
4
  PATCH = 12
5
- PRE = 20130305
5
+ PRE = 20130314
6
6
 
7
7
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join '.'
8
8
  end
data/test/fr_test.rb ADDED
@@ -0,0 +1,67 @@
1
+ # encoding: utf-8
2
+
3
+ require 'test_helper'
4
+ require 'inflections/fr'
5
+
6
+ class TestFrenchInflections < MiniTest::Unit::TestCase
7
+ def test_regular_plurals
8
+ assert_equal 'amis', 'ami'.pluralize
9
+ assert_equal 'ami', 'amis'.singularize
10
+
11
+ assert_equal 'fidèles', 'fidèle'.pluralize
12
+ assert_equal 'fidèle', 'fidèles'.singularize
13
+
14
+ assert_equal 'rapports', 'rapport'.pluralize
15
+ assert_equal 'rapport', 'rapports'.singularize
16
+ end
17
+
18
+ def test_appending_x
19
+ # -au
20
+ assert_equal 'tuyaux', 'tuyau'.pluralize
21
+ assert_equal 'tuyau', 'tuyaux'.singularize
22
+
23
+ # -ou
24
+ assert_equal 'genoux', 'genou'.pluralize
25
+ assert_equal 'genou', 'genoux'.singularize
26
+
27
+ # -eu
28
+ assert_equal 'aveux', 'aveu'.pluralize
29
+ assert_equal 'aveu', 'aveux'.singularize
30
+
31
+ # -eau
32
+ assert_equal 'nouveaux', 'nouveau'.pluralize
33
+ assert_equal 'nouveau', 'nouveaux'.singularize
34
+ end
35
+
36
+ def test_exceptions_to_appending_x
37
+ assert_equal 'bleus', 'bleu'.pluralize
38
+ assert_equal 'bleu', 'bleus'.singularize
39
+
40
+ assert_equal 'landaus', 'landau'.pluralize
41
+ assert_equal 'landau', 'landaus'.singularize
42
+
43
+ assert_equal 'genoux', 'genou'.pluralize
44
+ assert_equal 'genou', 'genoux'.singularize
45
+ end
46
+
47
+ def test_ending_in_al
48
+ assert_equal 'journaux', 'journal'.pluralize
49
+ assert_equal 'journal', 'journaux'.singularize
50
+ end
51
+
52
+ def test_ending_in_ail
53
+ assert_equal 'détails', 'détail'.pluralize
54
+ assert_equal 'détail', 'détails'.singularize
55
+ end
56
+
57
+ def test_exceptions_to_ending_in_ail
58
+ assert_equal 'travaux', 'travail'.pluralize
59
+ assert_equal 'travail', 'travaux'.singularize
60
+
61
+ assert_equal 'baux', 'bail'.pluralize
62
+ assert_equal 'bail', 'baux'.singularize
63
+
64
+ assert_equal 'émaux', 'émail'.pluralize
65
+ assert_equal 'émail', 'émaux'.singularize
66
+ end
67
+ end
data/test/test_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ $LOAD_PATH.unshift File.expand_path('../cases', __FILE__)
2
+
1
3
  require 'bundler/setup'
2
4
  require 'minitest/autorun'
5
+ require 'minitest/pride'
3
6
  require 'active_support/inflector'
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: 3.2.12.20130305
4
+ version: 3.2.12.20130314
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-05 00:00:00.000000000 Z
11
+ date: 2013-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -72,6 +72,7 @@ files:
72
72
  - lib/inflections/en-GB.rb
73
73
  - lib/inflections/en.rb
74
74
  - lib/inflections/es.rb
75
+ - lib/inflections/fr.rb
75
76
  - lib/inflections/kk.rb
76
77
  - lib/inflections/nb.rb
77
78
  - lib/inflections/railtie.rb
@@ -80,6 +81,7 @@ files:
80
81
  - test/en-GB_test.rb
81
82
  - test/en_test.rb
82
83
  - test/es_test.rb
84
+ - test/fr_test.rb
83
85
  - test/kk_test.rb
84
86
  - test/nb_test.rb
85
87
  - test/test_helper.rb
@@ -103,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
105
  version: '0'
104
106
  requirements: []
105
107
  rubyforge_project:
106
- rubygems_version: 2.0.0
108
+ rubygems_version: 2.0.2
107
109
  signing_key:
108
110
  specification_version: 4
109
111
  summary: Sane inflection rules for ActiveSupport.
@@ -111,6 +113,8 @@ test_files:
111
113
  - test/en-GB_test.rb
112
114
  - test/en_test.rb
113
115
  - test/es_test.rb
116
+ - test/fr_test.rb
114
117
  - test/kk_test.rb
115
118
  - test/nb_test.rb
116
119
  - test/tr_test.rb
120
+ has_rdoc: