aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/inflector
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-02-11 04:58:40 -0800
committerXavier Noria <fxn@hashref.com>2012-02-11 04:58:40 -0800
commit5f548eb28e526e14449f6595abee214ff8bf8dd2 (patch)
treeb3f022e7ec4a37d932a15af6c75f8ffeb0d14754 /activesupport/lib/active_support/inflector
parent69147ee0720b667aa2b7eb24a64639162ac844a3 (diff)
downloadrails-5f548eb28e526e14449f6595abee214ff8bf8dd2.tar.gz
rails-5f548eb28e526e14449f6595abee214ff8bf8dd2.tar.bz2
rails-5f548eb28e526e14449f6595abee214ff8bf8dd2.zip
say unshift when you mean unshift (modulus prepend)
Diffstat (limited to 'activesupport/lib/active_support/inflector')
-rw-r--r--activesupport/lib/active_support/inflector/inflections.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/inflector/inflections.rb b/activesupport/lib/active_support/inflector/inflections.rb
index 90bb62f57b..8cd96fe2d1 100644
--- a/activesupport/lib/active_support/inflector/inflections.rb
+++ b/activesupport/lib/active_support/inflector/inflections.rb
@@ -1,3 +1,5 @@
+require 'active_support/core_ext/array/prepend_and_append'
+
module ActiveSupport
module Inflector
# A singleton instance of this class is yielded by Inflector.inflections, which can then be used to specify additional
@@ -82,7 +84,7 @@ module ActiveSupport
def plural(rule, replacement)
@uncountables.delete(rule) if rule.is_a?(String)
@uncountables.delete(replacement)
- @plurals.insert(0, [rule, replacement])
+ @plurals.prepend([rule, replacement])
end
# Specifies a new singularization rule and its replacement. The rule can either be a string or a regular expression.
@@ -90,7 +92,7 @@ module ActiveSupport
def singular(rule, replacement)
@uncountables.delete(rule) if rule.is_a?(String)
@uncountables.delete(replacement)
- @singulars.insert(0, [rule, replacement])
+ @singulars.prepend([rule, replacement])
end
# Specifies a new irregular that applies to both pluralization and singularization at the same time. This can only be used
@@ -134,7 +136,7 @@ module ActiveSupport
# human /_cnt$/i, '\1_count'
# human "legacy_col_person_name", "Name"
def human(rule, replacement)
- @humans.insert(0, [rule, replacement])
+ @humans.prepend([rule, replacement])
end
# Clears the loaded inflections within a given scope (default is <tt>:all</tt>).