diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-03-30 01:08:33 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-03-30 01:08:33 -0300 |
commit | 3be1a75f3fff1042934ba60ae4093237a6b31712 (patch) | |
tree | 0f341af38f85d33e20cf6163a13962d5fc02a264 /activesupport/lib/active_support/inflector | |
parent | 0df82a64530ee208fc2a7d1b19af75a39c1a44a0 (diff) | |
parent | 7047e5562118d23c66c390b004f74ed35b90ab14 (diff) | |
download | rails-3be1a75f3fff1042934ba60ae4093237a6b31712.tar.gz rails-3be1a75f3fff1042934ba60ae4093237a6b31712.tar.bz2 rails-3be1a75f3fff1042934ba60ae4093237a6b31712.zip |
Merge pull request #23895 from glaucocustodio/add_upcase_first_method
Add upcase_first method
Diffstat (limited to 'activesupport/lib/active_support/inflector')
-rw-r--r-- | activesupport/lib/active_support/inflector/methods.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index f741c0bfb8..3fbc19ddf8 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -140,6 +140,13 @@ module ActiveSupport result end + # Converts just the first character to uppercase. + # + # 'what a Lovely Day'.upcase_first # => "What a Lovely Day" + def upcase_first(string) + string[0].upcase.concat(string[1..-1]) + end + # Capitalizes all the words and replaces some characters in the string to # create a nicer looking title. +titleize+ is meant for creating pretty # output. It is not used in the Rails internals. |