aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/inflector
Commit message (Collapse)AuthorAgeFilesLines
* Replace with gsub! in ActiveSupport::Inflector.Elben Shira2013-12-101-1/+2
|
* Change syntax format for example returned valuesPrem Sichanugrist2013-11-111-17/+17
| | | | | | | | | According to our guideline, we leave 1 space between `#` and `=>`, so we want `# =>` instead of `#=>`. Thanks to @fxn for the suggestion. [ci skip]
* Add +capitalize+ option to Inflector.humanizeclaudiob2013-11-061-9/+15
| | | | | | | So strings can be humanized without being capitalized: 'employee_salary'.humanize # => "Employee salary" 'employee_salary'.humanize(capitalize: false) # => "employee salary"
* Fix doc for singularize - `pluralized` => `singularized`Vipul A M2013-08-271-1/+1
|
* Speed up AS::Inflector.underscoreAkira Matsuda2013-07-101-2/+1
| | | | | | | Benchmark: user system total real old 6.090000 0.120000 6.210000 ( 6.202039) new 5.930000 0.110000 6.040000 ( 6.042022)
* Speedup AS::Inflector.camelizeAkira Matsuda2013-07-101-1/+3
| | | | | | | Benchmark: user system total real old 5.960000 0.020000 5.980000 ( 5.981754) new 5.740000 0.030000 5.770000 ( 5.757201)
* Speedup AS::Inflector.deconstantizeAkira Matsuda2013-07-101-1/+1
| | | | | | | Benchmark: user system total real old 0.740000 0.000000 0.740000 ( 0.744358) new 0.550000 0.000000 0.550000 ( 0.553690)
* Merge pull request #10542 from waseem/remove_requireCarlos Antonio da Silva2013-06-251-1/+0
|\ | | | | Remove unnecessary require from active_support/inflector/methods.rb
| * Remove unnecessary require from active_support/inflector/methods.rbWaseem Ahmad2013-05-101-1/+0
| | | | | | | | | | | | `active_support/inflections` already requires `active_support/inflector/inflections`. There's no need to require it in `active_support/inflector/methods`.
* | Updated the doc for const_regexp [ci skip]Arun Agrawal2013-06-151-1/+3
| |
* | Changing const_regexp to check for constant name.Arun Agrawal2013-06-151-0/+3
| | | | | | | | We need to return Regexp.escape(camel_cased_word) if the split is blank.
* | Fix #10932. Treat "" and "::" as invalid on constantizeNikolay Shebanov2013-06-141-1/+6
|/
* Revert "Merge pull request #8156 from fredwu/acronym_fix-master"Steve Klabnik2013-03-161-1/+1
| | | | | | | | | This reverts commit 867dc1700f32aae6f98c4651bd501597e6b52bc0, reversing changes made to 9a421aaa8285cf2a7ecb1af370748b0337818930. This breaks anyone who's using ForceSSL: https://travis-ci.org/rails-api/rails-api/jobs/5556065 Please see comments on #8156 for some discussion.
* Fixed a bug where the inflector would replace camelCase strings and ↵Fred Wu2013-03-171-1/+1
| | | | disregarding specified acronyms, fixes #8015
* resistance is futileXavier Noria2013-01-211-1/+1
|
* slices less, reads betterXavier Noria2013-01-211-13/+22
|
* Merge pull request #8671 from xuanxu/fix_irregularXavier Noria2013-01-211-0/+3
|\ | | | | Inflector irregular singularize rules
| * Inflector irregular singularize rulesJuanjo Bazán2013-01-011-0/+3
| |
* | Remove unnecessary begin..rescue..end, use only rescueAkira Matsuda2013-01-061-8/+6
|/
* Replace some global Hash usages with the new thread safe cache.thedarkone2012-12-141-2/+4
| | | | | | | | | | | | | | | | Summary of the changes: * Add thread_safe gem. * Use thread safe cache for digestor caching. * Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation. * Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache. * Use TS::Cache to avoid the synchronisation overhead on listener retrieval. * Replace synchronisation with TS::Cache usage. * Use a preallocated array for performance/memory reasons. * Update the controllers cache to the new AS::Dependencies::ClassCache API. The original @controllers cache no longer makes much sense after @tenderlove's changes in 7b6bfe84f3 and f345e2380c. * Use TS::Cache in the connection pool to avoid locking overhead. * Use TS::Cache in ConnectionHandler.
* Replace comments' non-breaking spaces with spacesclaudiob2012-12-041-4/+4
| | | | | | | | | | Sometimes, on Mac OS X, programmers accidentally press Option+Space rather than just Space and don’t see the difference. The problem is that Option+Space writes a non-breaking space (0XA0) rather than a normal space (0x20). This commit removes all the non-breaking spaces inadvertently introduced in the comments of the code.
* Refactor Inflector#ordinal to avoid converting the number twiceCarlos Antonio da Silva2012-11-041-2/+4
|
* update AS/inflector docs [ci skip]Francesco Rodriguez2012-09-143-142/+167
|
* update some AS code examples to 1.9 hash syntax [ci skip]Francesco Rodriguez2012-09-121-11/+11
|
* Make ActiveSupport::Inflector locale aware and multilingualDavid Celis2012-07-302-15/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Inflector is currently not very supportive of internationalized websites. If a user wants to singularize and/or pluralize words based on any locale other than English, they must define each case in locale files. Rather than create large locale files with mappings between singular and plural words, why not allow the Inflector to accept a locale? This patch makes ActiveSupport::Inflector locale aware and uses `:en`` unless otherwise specified. Users will still be provided a list of English (:en) inflections, but they may additionally define inflection rules for other locales. Each list is kept separately and permanently. There is no reason to limit users to one list of inflections: ActiveSupport::Inflector.inflections(:es) do |inflect| inflect.plural(/$/, 's') inflect.plural(/([^aeéiou])$/i, '\1es') inflect.plural(/([aeiou]s)$/i, '\1') inflect.plural(/z$/i, 'ces') inflect.plural(/á([sn])$/i, 'a\1es') inflect.plural(/é([sn])$/i, 'e\1es') inflect.plural(/í([sn])$/i, 'i\1es') inflect.plural(/ó([sn])$/i, 'o\1es') inflect.plural(/ú([sn])$/i, 'u\1es') inflect.singular(/s$/, '') inflect.singular(/es$/, '') inflect.irregular('el', 'los') end 'ley'.pluralize(:es) # => "leyes" 'ley'.pluralize(:en) # => "leys" 'avión'.pluralize(:es) # => "aviones" 'avión'.pluralize(:en) # => "avións" A multilingual Inflector should be of use to anybody that is tasked with internationalizing their Rails application. Signed-off-by: David Celis <david@davidcelis.com>
* make sure the inflection rules are loaded when cherry-picking ↵Xavier Noria2012-06-292-0/+3
| | | | active_support/core_ext/string/inflections.rb [fixes #6884]
* Fix warning: shadowing outer local variable - constant.kennyj2012-05-191-3/+3
|
* Handle case where ancestor is not the end of the chainAndrew White2012-05-191-7/+12
|
* Fix constantize so top level constants are looked up properly.Marc-Andre Lafortune2012-05-191-1/+1
|
* Make constantize look down the ancestor chain (excluding Object)Marc-Andre Lafortune2012-05-191-1/+13
|
* Revert "Merge pull request #6354 from lest/patch-1"Carlos Galdino + Rafael Mendonça França2012-05-161-1/+1
| | | | | | | This reverts commit e8feaff60b9c04d34ad234f7d17b5d2ad9cc7a24, reversing changes made to 9adf28c026070afb78b80027521a4ddddd68d697. Reason: This broke the actionmailer tests
* remove unnecessary requireSergey Nartimov2012-05-161-1/+1
| | | | | - access & filters don't use multibyte ext - transliterate requires only AS::Multibyte but not multibyte ext
* removing unnecessary 'examples' noise from activesupportFrancesco Rodriguez2012-05-133-23/+1
|
* fix typo in ActiveSupport::Inflector#titleizeFrancesco Rodriguez2012-04-281-1/+1
|
* revises the regexp used in titleizeXavier Noria2012-04-071-1/+1
| | | | | | | | | The regexp used in titleize matches saxon genitive and other contractions, only to call capitalize on the captured text and have the apostrophe upcased which yields the apostrophe itself. It is more clear that the regexp matches just what it has to match.
* Updated/changed useless tr/gsubsJurriaan Pruis2012-04-031-1/+1
|
* Fix typoArtyom Bolshakov2012-04-031-1/+1
|
* String#titleize works properly with smart quotes, closes #5584Vasiliy Ermolovich2012-03-261-2/+4
|
* Inflector/constantize - inject method lets us to avoid using another variablehoma2012-02-281-5/+3
|
* decouples the implementation of the inflector from its test suiteXavier Noria2012-02-241-0/+7
| | | | | | | | Trying alternative implementations of the inflections is hard because the suite is coupled with the current one, setting ivars by hand etc. This commit relies on initialize_dup, as long as you maintain that one you can tweak the implementation.
* prefer tr to gsub for replacing charactersXavier Noria2012-02-121-2/+2
|
* inflection regexp are meant to be applied onceXavier Noria2012-02-121-2/+2
|
* removes redundant argumentXavier Noria2012-02-121-1/+1
|
* boosts inflectionsXavier Noria2012-02-121-1/+1
| | | | | The impact of this change has been measured pluralizing the entire /usr/share/dict/words, showing a 6x speedup
* say unshift when you mean unshift (modulus prepend)Xavier Noria2012-02-111-3/+5
|
* Add ActiveSupport::Inflector.ordinal and Integer#ordinalTim Gildea2012-02-041-10/+24
|
* There is an "inherit" option on const_get too, why not use it?Semyon Perepelitsa2012-01-311-1/+1
|
* safe_constantize should handle wrong constant name NameErrors Fixes #4710Alex Tambellini2012-01-261-1/+1
|
* global variables may not be set depending on the match. fixes #4703Aaron Patterson2012-01-261-1/+4
|
* Change ActiveRecord::Errors to ActiveModel::Errors in guidesCarlos Antonio da Silva2012-01-251-6/+6
| | | | | | | Use ActiveModel::Errors in inflection example docs as well. Also fixes wrong information and link to locale file related to Errors#full_messages in I18n guide.