inflections 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -0
- data/CHANGELOG.markdown +12 -0
- data/README.markdown +10 -4
- data/Rakefile +9 -1
- data/inflections.gemspec +2 -2
- data/lib/inflections/en.rb +22 -0
- data/lib/inflections/version.rb +1 -1
- data/{inflections_test.rb → test/en_test.rb} +2 -2
- data/test/test_helper.rb +3 -0
- metadata +9 -7
- data/lib/inflections.rb +0 -22
data/.travis.yml
ADDED
data/CHANGELOG.markdown
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
0.0.3 (current version)
|
2
|
+
=======================
|
3
|
+
* Code reorganization. Inflections will now be located under `lib/inflections/` and will be named as according to their I18n abbreviation.
|
4
|
+
* Tests have also been reorganized. They live in the `test/` directory (big surprise) and, like the inflection files, should be named as according to their I18n abbreviation (`en_test.rb`, `es_test.rb`, `de_test.rb`, etc.)
|
5
|
+
|
6
|
+
0.0.2
|
7
|
+
=====
|
8
|
+
* Travis CI support
|
9
|
+
|
10
|
+
0.0.1
|
11
|
+
=====
|
12
|
+
* Initial version: support for English.
|
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Inflections
|
1
|
+
# Inflections [![Build Status](https://secure.travis-ci.org/davidcelis/inflections.png)](http://travis-ci.org/davidcelis/inflections)
|
2
2
|
|
3
3
|
This gem is to remove the cruft from ActiveSupport's inflections and provide a more sane set of defaults for Ruby/Rails applications.
|
4
4
|
|
@@ -8,10 +8,10 @@ Many of the special cases that ActiveSupport defines will not see the light of d
|
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
Add
|
11
|
+
Add the following to your application's Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'inflections'
|
14
|
+
gem 'inflections', :require => 'inflections/en' # Or replace 'en' with your language's i18n abbreviation
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
@@ -45,9 +45,15 @@ ActiveSupport::Inflector.inflections do |inflect|
|
|
45
45
|
end
|
46
46
|
```
|
47
47
|
|
48
|
+
## Languages Currently Supported
|
49
|
+
|
50
|
+
* English (en)
|
51
|
+
|
52
|
+
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. I would love to support more than just English.
|
53
|
+
|
48
54
|
## Contributing
|
49
55
|
|
50
|
-
Please note that pull requests 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
|
56
|
+
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.
|
51
57
|
|
52
58
|
1. Fork it
|
53
59
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
data/Rakefile
CHANGED
data/inflections.gemspec
CHANGED
@@ -9,12 +9,12 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.homepage = 'https://github.com/davidcelis/inflections'
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
|
-
gem.test_files =
|
12
|
+
gem.test_files = Dir.glob('test/*_test.rb')
|
13
13
|
gem.name = 'inflections'
|
14
14
|
gem.require_paths = ['lib']
|
15
15
|
gem.version = Inflections::VERSION
|
16
16
|
|
17
|
-
gem.add_development_dependency '
|
17
|
+
gem.add_development_dependency 'rake'
|
18
18
|
gem.add_development_dependency 'minitest'
|
19
19
|
|
20
20
|
gem.add_dependency 'activesupport', '>= 2.2.1'
|
@@ -0,0 +1,22 @@
|
|
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
|
data/lib/inflections/version.rb
CHANGED
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inflections
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: rake
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
@@ -68,14 +68,17 @@ extensions: []
|
|
68
68
|
extra_rdoc_files: []
|
69
69
|
files:
|
70
70
|
- .gitignore
|
71
|
+
- .travis.yml
|
72
|
+
- CHANGELOG.markdown
|
71
73
|
- Gemfile
|
72
74
|
- LICENSE
|
73
75
|
- README.markdown
|
74
76
|
- Rakefile
|
75
77
|
- inflections.gemspec
|
76
|
-
-
|
77
|
-
- lib/inflections.rb
|
78
|
+
- lib/inflections/en.rb
|
78
79
|
- lib/inflections/version.rb
|
80
|
+
- test/en_test.rb
|
81
|
+
- test/test_helper.rb
|
79
82
|
homepage: https://github.com/davidcelis/inflections
|
80
83
|
licenses: []
|
81
84
|
post_install_message:
|
@@ -101,5 +104,4 @@ signing_key:
|
|
101
104
|
specification_version: 3
|
102
105
|
summary: Sane inflection rules for ActiveSupport.
|
103
106
|
test_files:
|
104
|
-
-
|
105
|
-
has_rdoc:
|
107
|
+
- test/en_test.rb
|
data/lib/inflections.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'active_support/inflector'
|
2
|
-
|
3
|
-
ActiveSupport::Inflector.inflections do |inflect|
|
4
|
-
inflect.clear
|
5
|
-
|
6
|
-
inflect.plural(/$/, 's')
|
7
|
-
inflect.plural(/([sxz]|[cs]h)$/i, '\1es')
|
8
|
-
inflect.plural(/([^aeiouy]o)$/i, '\1es')
|
9
|
-
inflect.plural(/([^aeiouy])y$/i, '\1ies')
|
10
|
-
|
11
|
-
inflect.singular(/s$/i, '')
|
12
|
-
inflect.singular(/(ss)$/i, '\1')
|
13
|
-
inflect.singular(/([sxz]|[cs]h)es$/, '\1')
|
14
|
-
inflect.singular(/([^aeiouy]o)es$/, '\1')
|
15
|
-
inflect.singular(/([^aeiouy])ies$/i, '\1y')
|
16
|
-
|
17
|
-
inflect.irregular('child', 'children')
|
18
|
-
inflect.irregular('person', 'people')
|
19
|
-
inflect.irregular('self', 'selves')
|
20
|
-
|
21
|
-
inflect.uncountable(%w(series))
|
22
|
-
end
|