Module: Sinatra::Asterisk::Utils
- Defined in:
- lib/sinatra/asterisk/utils.rb
Class Method Summary collapse
-
.camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) ⇒ Object
Borrowed from activesupport-3.0.4.
Class Method Details
.camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) ⇒ Object
Borrowed from activesupport-3.0.4
5 6 7 8 9 10 11 |
# File 'lib/sinatra/asterisk/utils.rb', line 5 def self.camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) if first_letter_in_uppercase lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } else lower_case_and_underscored_word.to_s[0].chr.downcase + camelize(lower_case_and_underscored_word)[1..-1] end end |