aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/string/inflections.rb
Commit message (Collapse)AuthorAgeFilesLines
* code gardening: removes redundant selfsXavier Noria2016-08-081-1/+1
| | | | | | | | | A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in activesupport/libXavier Noria2016-08-061-3/+3
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix method String#upcase_firstbogdanvlviv2016-03-311-1/+3
|
* Add upcase_first methodGlauco Custódio2016-02-251-0/+7
|
* Parameterize with options to preserve case of stringSwaathi K2015-11-071-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | Added test cases Using kwargs instead of three seperate functions Updated parameterize in transliterate.rb Updated parameterize in transliterate.rb Added deprecation warnings and updating RDoc+Guide Misspelled separtor. Fixed. Deprecated test cases and added support to parameterize with keyword parameters Squashing commits. Fixed test cases and added deprecated test cases Small changes to Gemfile.lock and CHANGELOG Update Gemfile.lock
* Merge pull request #21217 from myrridin/myrridin-documentation-updatesZachary Scott2015-08-121-2/+2
|\ | | | | [ci skip] Documentation: Switch around a common phrase for readability
| * [ci skip] Switch around a common idiom for readabilityThomas Hart II2015-08-051-2/+2
| |
* | String#freeze optimizationsschneems2015-07-301-1/+1
|/
* Doc fixes [ci skip]Islam Wazery2015-03-071-1/+1
|
* [ci skip] ActiveSupport CHANGELOG fixesAkshay Vishnoi2014-09-181-0/+1
| | | | | | | 1. spacing issues 2. spelling correction 3. grammar correction 4. Add missing docs
* Fix inconsistent behavior from String#pluralizeKuldeep Aggarwal2014-04-191-1/+1
| | | | | | | | | | | Before: When calling String#pluralize with count=1 then it returned same string, but with count other than 1, returned new string. After: String#pluralize always return a new string. => Prevent mutation of a string inadvertently.
* Add more test case for #demodulize, Improve documentationAkshay Vishnoi2014-04-111-0/+2
|
* [ci skip] removed singulars section from classify docGreg Molnar2013-11-271-4/+0
|
* Add +capitalize+ option to Inflector.humanizeclaudiob2013-11-061-5/+11
| | | | | | | So strings can be humanized without being capitalized: 'employee_salary'.humanize # => "Employee salary" 'employee_salary'.humanize(capitalize: false) # => "employee salary"
* Changed spelling of Busines to Businessaditya-kapoor2013-05-081-1/+1
|
* Corrected paramter to parameterCarson McDonald2013-04-131-1/+1
|
* Revert "Merge pull request #10158 from steveklabnik/issue_10125"Rafael Mendonça França2013-04-101-2/+2
| | | | | | | | This reverts commit fa3ef8e82ab2f96cf15ef9bc885b2468fad77621, reversing changes made to e0af93dd3a5eeee2e2a67b05f34afb66cc80c00b. Reason: Routes, Active Record and the rendering stack should not depend on the default locale
* Fix inflector to respect default locale.Nick Cox2013-04-101-2/+2
| | | | | | | | The inflector was made aware of locales in 7db0b073fec6bc3e6f213b58c76e7f43fcc2ab97, but it defaulted to :en. That should actually be our default locale instead. Fixes #10125
* Merge pull request #8560 from u16suzu/masterRafael Mendonça França2012-12-201-2/+2
|\ | | | | | | | | | | | | Fix document for String#humanize Conflicts: activesupport/lib/active_support/core_ext/string/inflections.rb
| * Fix: documentation for String#humanizeYuichiro Suzuki2012-12-201-2/+2
| |
* | Adding a missing parenthesis in the doc of String#parameterize.Geoffrey Roguelon2012-10-241-2/+2
| |
* | Make ActiveSupport::Inflector locale aware and multilingualDavid Celis2012-07-301-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix doc example for dasherizeMarc-Andre Lafortune2012-06-151-1/+1
| |
* | remove unnecessary 'examples' noiseFrancesco Rodriguez2012-05-111-6/+0
| |
* | String quotes and trailing spacesAlexey Gaziev2012-04-291-48/+48
| |
* | AS core_ext refactoring pt.2Alexey Gaziev2012-04-291-2/+4
|/
* Change ActiveRecord::Errors to ActiveModel::Errors in guidesCarlos Antonio da Silva2012-01-251-2/+2
| | | | | | | 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.
* fixes a typo (thanks to Alexey Vakhov)Xavier Noria2011-10-301-1/+1
|
* defines Module#qualified_const_(defined?|get|set) and String#deconstantizeXavier Noria2011-10-291-0/+15
| | | | | | | | | | This commit also implements a faster version of #demodulize I was unable to isolate with git add --patch. Not a big fan of the name #deconstantize. It complements #demodulize getting rid of the rightmost constant, hence the name, but it is unrelated to the well-known #constantize. So unsure. Could not come with anything better, please feel free to rename.
* Modified String#pluralize to take an optional count parameter.Ryan Oblak2011-09-281-3/+14
|
* Minor doc fix to String#constantizeRyan Oblak2011-09-231-3/+3
|
* Added ActiveSupport::Inflector.safe_constantize and String#safe_constantize; ↵Ryan Oblak2011-09-231-3/+16
| | | | refactored common constantize tests into ConstantizeTestCases
* RefactorDavid Lee2011-06-111-1/+0
|
* Correct bad wording in description.Ben Orenstein2011-02-141-1/+1
|
* adds missing require for #parameterizeXavier Noria2010-08-261-0/+2
|
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-6/+6
| | | | 's/[ \t]*$//' -i {} \;)
* Add another missing require in 'active_support/inflector/inflections'Carl Lerche2010-07-291-0/+1
|
* Add a missing require in 'active_support/core_ext/string/inflections'Carl Lerche2010-07-291-0/+1
|
* Move constantize from conversions to inflections.Santiago Pastorino2010-06-261-0/+11
| | | | | | | | This removes ActiveModel dependency on TZInfo. [#4979 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* ActiveSupport::Dependencies.constantize shortcut for caching named constant ↵Jeremy Kemper2010-06-051-11/+0
| | | | lookups
* Remove some 1.9 warnings (resulting in some fixed bugs). Remaining AM ↵wycats2010-03-171-2/+0
| | | | warnings are in dependencies.
* Inflection dependency, [#4067 status:resolved]Jason King2010-03-031-1/+3
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Convert string extension modules to class reopensJeremy Kemper2009-04-221-153/+146
|
* Allow String#parameterize to accept a separator [#2157 state:resolved]Sam Granieri2009-03-071-2/+2
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Avoid circular requireJeremy Kemper2009-02-061-1/+1
|
* Added Inflector#parameterize for easy slug generation ("Donald E. ↵David Heinemeier Hansson2008-09-101-0/+19
| | | | Knuth".parameterize => "donald-e-knuth") #713 [Matt Darby]
* Merge with docrails.Pratik Naik2008-07-161-2/+2
|
* Improve documentation.Pratik Naik2008-03-261-64/+56
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9093 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Improve documentation to classify to make it clear that it expects names to ↵Michael Koziarski2008-01-081-2/+5
| | | | | | be plural. Reference #10615 [kris_chambers] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8596 5ecf4fe2-1ee6-0310-87b1-e25e094e27de