Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/pay_u/util/string.rb
Instance Method Summary collapse
Instance Method Details
#to_camel ⇒ Object
7 8 9 10 11 |
# File 'lib/pay_u/util/string.rb', line 7 def to_camel split("_").inject([]) do |memo, char| memo.push(memo.empty? ? char : char.capitalize) end.join end |
#to_underscore ⇒ Object
2 3 4 |
# File 'lib/pay_u/util/string.rb', line 2 def to_underscore gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase end |