Commit Graph

32 Commits

Author SHA1 Message Date
Juanjo Bazán
ef4ac7a489 Inflector irregular singularize rules 2013-01-01 12:50:00 +01:00
Godfrey Chan
fe933be5e2 Adds missing inflector tests to ensure idempotency
This is a follow up to #4719. It appears that singularize and pluralize
are supposed to be idempotent - i.e. when you call singularize or
pluralize multiple times on the same string, you should get the same
result. (At least for the "officially supported" cases that the stock
inflector is designed to handle.) #4719 added the missing tests for
regular cases, and this commit added the missing tests for the
irregularities.

While I'm at that, I also synced up the irregularity test cases with
the current set of irregularity cases that we ship out-of-the-box.
2012-06-21 02:16:48 -07:00
Anuj Dutta
bc51ad957a Fix an issue with inflection where my_analyses (in plular form) incorrectly converted to my_analyasis(in singular form). 2012-05-16 22:58:03 +01:00
José Valim
66c5ac3be9 Merge pull request #5177 from cap10morgan/fix-gh-issue-4374
fix inflector bug where -ice gets singularized into -ouse
2012-04-30 00:13:40 -07:00
Xavier Noria
206974a97c adds a new test case for titleize 2012-04-08 01:10:08 +02:00
Xavier Noria
4b685aad7b revises the regexp used in titleize
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.
2012-04-07 23:58:44 +02:00
Vasiliy Ermolovich
633ee64e20 String#titleize works properly with smart quotes, closes #5584 2012-03-26 21:18:25 +03:00
Wes Morgan
16e7f2f809 fix inflector bug where -ice gets pluralized into -ouse
This should happen for mouse or louse, but not slice or pumice.
2012-02-25 14:22:15 -07:00
Xavier Noria
fd5d9b366c fixes a regression introduced by 532cd4, and a bogus test in AP the regression uncovered 2012-02-10 22:17:30 -08:00
Mark Rushakoff
6f253fb440 Fix inflection regexes for mouse, mice 2011-12-07 23:14:02 -08:00
Pavan Kumar Sunkara
1934b77406 Added the test case for #3537 2011-11-06 19:22:46 +05:30
José Valim
6b010c2690 Revert removing gsub and sub from safe buffer. 2011-09-08 20:54:30 +02:00
Damien Mathieu
3718ccd2a6 remove support of symbols on classify and camelize 2011-09-08 10:22:21 +02:00
Arun Agrawal
4700e1fe6e StringToParameterizeWithNoSeparator: dashed parameter will not
change.
2011-06-25 06:17:00 +05:30
David Lee
f3e8bb8394 Test retain delimiter in parameterization inflector 2011-06-11 01:35:16 -07:00
Jason
3880ab0d7c ordinalize negative numbers patch
Applied patch by Amir Manji
  https://github.com/rails/rails/issues/437#issuecomment-1116045

Signed-off-by: Jason <jasonmichaelroth@gmail.com>
2011-05-07 13:21:00 -06:00
Dan Pickett
1754bd9b20 handle double pluralization for irregular plurals
[#6363]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-16 15:08:25 -02:00
Norman Clarke
dceef0828a Improve reliability of Inflector.transliterate. [#4374 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-12 23:19:39 -07:00
Rolf Bjaanes
4eab983b95 Changed the way inflections for uncountables work for 'funky jeans' [#3576 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-05 23:54:42 +02:00
Kristopher Murata
ef84e691ff Parameterize should accept malformed utf8 characters [#4323 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-04 09:37:26 -07:00
wycats
7a83abe52f Any reason we can't just use the slow 1.8 path for transliteration in 1.9? 2010-03-17 00:54:42 -07:00
Stijn Mathysen
67512b9489 Removed the + sign as an accepted character from the parameterize method, as a + sign is interpreted by the browser as a space, possibly resulting in a "ArgumentError: illegal character in key"
[#4080 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-05 14:11:21 -08:00
Yehuda Katz + Carl Lerche
882dd4e605 ensure Inflector.camelize works with symbols [#2856 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-01 12:14:34 -07:00
Sam Granieri
20d3892f46 Allow String#parameterize to accept a separator [#2157 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-07 10:54:27 +00:00
Jiri Zajpt
7ed2e6c463 Adding inflection of databases (usually we wouldn't amend the current defaults, but this seems to obvious) [#1942 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2009-02-12 14:31:27 +01:00
Jeremy Kemper
2c43a6429e Ruby 1.9 compat: no Unicode normalization support yet 2008-11-26 17:59:35 -08:00
Jeremy Kemper
5bc91b0592 Mark utf-8 source encoding 2008-10-06 10:56:56 -07:00
Adam Cigánek
a4f2ba8fb3 Modified ActiveSupport::Inflector#parameterize with code from slugalizer (http://github.com/henrik/slugalizer)
Handles trailing and leading slashes, and squashes repeated separators into a single character.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1034 state:committed]
2008-09-23 08:08:21 +02:00
Michael Koziarski
1ddde91303 Flesh out the parameterize method to support non-ascii text and underscores. 2008-09-11 17:10:17 +02:00
David Heinemeier Hansson
90366a1521 Added Inflector#parameterize for easy slug generation ("Donald E. Knuth".parameterize => "donald-e-knuth") #713 [Matt Darby] 2008-09-10 00:36:37 -05:00
David Heinemeier Hansson
3229b59495 Fixed String#titleize to work for strings with 's too (closes #10571) [trek]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8533 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-03 00:16:47 +00:00
Jeremy Kemper
db9b2f5c22 Extract InflectorTestCases so both inflector and string inflections tests can use them.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7655 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-27 10:19:48 +00:00