inflections 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
- 0.0.4 (current version)
1
+ 0.0.5 (current version)
2
2
  =======================
3
+ * Rails users no longer need to specify a locale to load; inflections are automagically loaded depending on `I18n.default_locale`
4
+
5
+ 0.0.4
6
+ =====
3
7
  * Support for Spanish (es)
4
8
 
5
9
  0.0.3
@@ -1,8 +1,8 @@
1
1
  # Inflections [![Build Status](https://secure.travis-ci.org/davidcelis/inflections.png)](http://travis-ci.org/davidcelis/inflections)
2
2
 
3
- This gem is to remove the cruft from ActiveSupport's inflections and provide a more sane set of defaults for Ruby/Rails applications.
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.
4
4
 
5
- At the time of this gem's publication, the 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
+ 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.
6
6
 
7
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")?
8
8
 
@@ -11,7 +11,7 @@ Many of the special cases that ActiveSupport defines will not see the light of d
11
11
  Add the following to your application's Gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'inflections', :require => 'inflections/en' # Or replace 'en' with your language's I18n abbreviation
14
+ gem 'inflections'
15
15
  ```
16
16
 
17
17
  And then execute:
@@ -24,14 +24,14 @@ $ bundle
24
24
 
25
25
  ### Ruby on Rails
26
26
 
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`.
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`. I18n's default locale (set in `config/application.rb` will determine which inflections are loaded)
28
28
 
29
29
  ### Otherwise
30
30
 
31
31
  Wherever you need 'em:
32
32
 
33
33
  ```ruby
34
- require 'inflections/en'
34
+ require 'inflections/en' # Replace 'en' with your preferred locale.
35
35
  ```
36
36
 
37
37
  Define your own defaults as such:
@@ -0,0 +1 @@
1
+ require 'inflections/railtie' if defined?(Rails)
@@ -0,0 +1,10 @@
1
+ module Inflections
2
+ class Railtie < Rails::Railtie
3
+ begin
4
+ require "inflections/#{config.i18n.default_locale}"
5
+ rescue LoadError => e
6
+ warn "Inflections currently does not support your default_locale. Defaulting to English (en)."
7
+ require 'inflections/en'
8
+ end
9
+ end
10
+ end
@@ -1,7 +1,7 @@
1
1
  module Inflections
2
2
  MAJOR = 0
3
3
  MINOR = 0
4
- PATCH = 4
4
+ PATCH = 5
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].compact.join '.'
7
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.4
4
+ version: 0.0.5
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-27 00:00:00.000000000 Z
12
+ date: 2012-07-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -75,8 +75,10 @@ files:
75
75
  - README.markdown
76
76
  - Rakefile
77
77
  - inflections.gemspec
78
+ - lib/inflections.rb
78
79
  - lib/inflections/en.rb
79
80
  - lib/inflections/es.rb
81
+ - lib/inflections/railtie.rb
80
82
  - lib/inflections/version.rb
81
83
  - test/en_test.rb
82
84
  - test/es_test.rb