Revert "Merge pull request #8156 from fredwu/acronym_fix-master"
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.
This commit is contained in:
parent
19797df29e
commit
feaa6e2048
@ -1,10 +1,5 @@
|
|||||||
## Rails 4.0.0 (unreleased) ##
|
## Rails 4.0.0 (unreleased) ##
|
||||||
|
|
||||||
* Fixed a bug in `ActiveSupport::Inflector#underscore` where acroynms are
|
|
||||||
incorrectly parsed as camelCases.
|
|
||||||
|
|
||||||
*Fred Wu*
|
|
||||||
|
|
||||||
* Fix deletion of empty directories in `ActiveSupport::Cache::FileStore`.
|
* Fix deletion of empty directories in `ActiveSupport::Cache::FileStore`.
|
||||||
|
|
||||||
*Charles Jones*
|
*Charles Jones*
|
||||||
|
@ -91,7 +91,7 @@ def underscore(camel_cased_word)
|
|||||||
word = camel_cased_word.to_s.dup
|
word = camel_cased_word.to_s.dup
|
||||||
word.gsub!('::', '/')
|
word.gsub!('::', '/')
|
||||||
word.gsub!(/(?:([A-Za-z\d])|^)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1}#{$1 && '_'}#{$2.downcase}" }
|
word.gsub!(/(?:([A-Za-z\d])|^)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1}#{$1 && '_'}#{$2.downcase}" }
|
||||||
word.gsub!(/(?!#{inflections.acronym_regex})\b([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
|
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
|
||||||
word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
||||||
word.tr!("-", "_")
|
word.tr!("-", "_")
|
||||||
word.downcase!
|
word.downcase!
|
||||||
|
@ -167,13 +167,11 @@ def test_acronyms_camelize_lower
|
|||||||
def test_underscore_acronym_sequence
|
def test_underscore_acronym_sequence
|
||||||
ActiveSupport::Inflector.inflections do |inflect|
|
ActiveSupport::Inflector.inflections do |inflect|
|
||||||
inflect.acronym("API")
|
inflect.acronym("API")
|
||||||
inflect.acronym("APIs")
|
|
||||||
inflect.acronym("JSON")
|
inflect.acronym("JSON")
|
||||||
inflect.acronym("HTML")
|
inflect.acronym("HTML")
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal("json_html_api", ActiveSupport::Inflector.underscore("JSONHTMLAPI"))
|
assert_equal("json_html_api", ActiveSupport::Inflector.underscore("JSONHTMLAPI"))
|
||||||
assert_equal("namespaced/apis", ActiveSupport::Inflector.underscore("Namespaced::APIs"))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_underscore
|
def test_underscore
|
||||||
|
Loading…
Reference in New Issue
Block a user