aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/string/inflections.rb
Commit message (Collapse)AuthorAgeFilesLines
* Update docs for 'parameterize()' [ci skip]Sharang Dashputre2019-03-161-1/+1
|
* Add locale option to parameterizeKaan Ozkan2019-03-111-2/+7
| | | | | | Parameterize is triggering I18n#transliterate. This method already accepts a locale. It would be cleaner if similar to other string inflection methods #parameterize also accepted 'locale' as a parameter.
* Update incorrect backtick usage in RDoc to teletypeT.J. Schuck2017-11-221-1/+1
| | | [ci skip]
* [Active Support] require_relative => requireAkira Matsuda2017-10-211-2/+2
| | | | This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
* Update String#camelize to provide feedback when wrong option is passedRicardo Díaz2017-08-021-0/+2
| | | | | | | | | String#camelize was returning nil without any feedback when an invalid option was passed as parameter. This update makes the method to raises an ArgumentError when the option passed is invalid, similar to what Ruby does for String#downcase (and others) in 2.4.1. https://ruby-doc.org/core-2.4.1/String.html#method-i-downcase
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* [Active Support] require => require_relativeAkira Matsuda2017-07-011-2/+2
|
* Use keyword arguments instead of hashRafael Mendonça França2017-03-281-4/+4
|
* Merge pull request #28480 from ↵Rafael Mendonça França2017-03-281-9/+19
|\ | | | | | | | | | | mubashirhanif/add_keep_id_suffix_option_to_humanize_new Add keep id suffix option to humanize new
| * Added options hash to titleize method and keep_id_suffix option to humanizeMubashir Hanif2017-03-211-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | some documentation remove extra whitespace. Added id in the middle test case and corrected some testcases. Some Coding standard guidelines corrections as suggested by codeclimate. Some more corrections suggested by codeclimate.
* | There's no such moduleAkira Matsuda2017-01-051-4/+4
|/
* Remove deprecated separator argument from parameterizeAndrew White2016-11-141-5/+1
|
* Add missing `+` around a some literals.bogdanvlviv2016-10-271-1/+1
| | | | | | Mainly around `nil` [ci skip]
* 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
|