diff options
author | Francesco Rodríguez <frodsan@me.com> | 2018-10-11 11:00:46 +0200 |
---|---|---|
committer | Francesco Rodríguez <frodsan@me.com> | 2018-10-12 07:47:23 +0200 |
commit | 16e3b65674e3a41afe0415c88c75667e72fd0de9 (patch) | |
tree | 6bfcbcacbd0404bd25c56a76230853214a201f71 /activesupport/lib/active_support/multibyte/chars.rb | |
parent | e52b223487c4a72ccdd6d631318fc3cfcf8097ba (diff) | |
download | rails-16e3b65674e3a41afe0415c88c75667e72fd0de9.tar.gz rails-16e3b65674e3a41afe0415c88c75667e72fd0de9.tar.bz2 rails-16e3b65674e3a41afe0415c88c75667e72fd0de9.zip |
Use native String#capitalize
Diffstat (limited to 'activesupport/lib/active_support/multibyte/chars.rb')
-rw-r--r-- | activesupport/lib/active_support/multibyte/chars.rb | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index fec6667ce7..01a0cc131f 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -120,13 +120,6 @@ module ActiveSupport #:nodoc: slice(0...translate_offset(limit)) end - # Converts the first character to uppercase and the remainder to lowercase. - # - # 'über'.mb_chars.capitalize.to_s # => "Über" - def capitalize - (slice(0) || chars("")).upcase + (slice(1..-1) || chars("")).downcase - end - # Capitalizes the first letter of every word, when possible. # # "ÉL QUE SE ENTERÓ".mb_chars.titleize.to_s # => "Él Que Se Enteró" @@ -184,7 +177,7 @@ module ActiveSupport #:nodoc: to_s.as_json(options) end - %w(capitalize reverse tidy_bytes).each do |method| + %w(reverse tidy_bytes).each do |method| define_method("#{method}!") do |*args| @wrapped_string = send(method, *args).to_s self |