inflections 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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, wherever you need 'em:
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.
@@ -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.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
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
@@ -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/, '\1')
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
 
@@ -1,3 +1,7 @@
1
1
  module Inflections
2
- VERSION = "0.0.1"
2
+ MAJOR = 0
3
+ MINOR = 0
4
+ PATCH = 2
5
+
6
+ VERSION = [MAJOR, MINOR, PATCH].compact.join '.'
3
7
  end
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.1
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-19 00:00:00.000000000 Z
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: