inflections 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +16 -1
- data/inflections.gemspec +1 -2
- data/lib/inflections.rb +1 -4
- data/lib/inflections/version.rb +5 -1
- metadata +4 -3
data/README.markdown
CHANGED
@@ -22,14 +22,29 @@ $ bundle
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
+
### Ruby on Rails
|
26
|
+
|
25
27
|
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`.
|
26
28
|
|
27
|
-
Otherwise
|
29
|
+
### Otherwise
|
30
|
+
|
31
|
+
Wherever you need 'em:
|
28
32
|
|
29
33
|
```ruby
|
30
34
|
require 'inflections'
|
31
35
|
```
|
32
36
|
|
37
|
+
Define your own defaults as such:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
ActiveSupport::Inflector.inflections do |inflect|
|
41
|
+
inflect.singular /(phase)s$/i, '\1'
|
42
|
+
inflect.plural /(shel|kni)fe/, '\1ves'
|
43
|
+
inflect.irregular 'foot', 'feet'
|
44
|
+
inflect.uncountable %w( money )
|
45
|
+
end
|
46
|
+
```
|
47
|
+
|
33
48
|
## Contributing
|
34
49
|
|
35
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 involved 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.
|
data/inflections.gemspec
CHANGED
@@ -9,8 +9,7 @@ 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.
|
13
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
12
|
+
gem.test_files = ['inflections_test.rb']
|
14
13
|
gem.name = 'inflections'
|
15
14
|
gem.require_paths = ['lib']
|
16
15
|
gem.version = Inflections::VERSION
|
data/lib/inflections.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
require 'active_support/inflector'
|
2
2
|
|
3
|
-
module Inflections
|
4
|
-
end
|
5
|
-
|
6
3
|
ActiveSupport::Inflector.inflections do |inflect|
|
7
4
|
inflect.clear
|
8
5
|
|
@@ -13,7 +10,7 @@ ActiveSupport::Inflector.inflections do |inflect|
|
|
13
10
|
|
14
11
|
inflect.singular(/s$/i, '')
|
15
12
|
inflect.singular(/(ss)$/i, '\1')
|
16
|
-
inflect.singular(/([sxz]|[cs]h)es
|
13
|
+
inflect.singular(/([sxz]|[cs]h)es$/, '\1')
|
17
14
|
inflect.singular(/([^aeiouy]o)es$/, '\1')
|
18
15
|
inflect.singular(/([^aeiouy])ies$/i, '\1y')
|
19
16
|
|
data/lib/inflections/version.rb
CHANGED
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.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -100,5 +100,6 @@ rubygems_version: 1.8.23
|
|
100
100
|
signing_key:
|
101
101
|
specification_version: 3
|
102
102
|
summary: Sane inflection rules for ActiveSupport.
|
103
|
-
test_files:
|
103
|
+
test_files:
|
104
|
+
- inflections_test.rb
|
104
105
|
has_rdoc:
|