Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/pay_u/util/string.rb

Instance Method Summary collapse

Instance Method Details

#to_camelObject



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_underscoreObject



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