Class: String
Instance Method Summary collapse
Instance Method Details
#to_camel ⇒ Object
16 17 18 |
# File 'lib/ezframe/util.rb', line 16 def to_camel self.split("_").map{|w| w[0] = w[0].upcase; w}.join end |
#to_snake ⇒ Object
12 13 14 |
# File 'lib/ezframe/util.rb', line 12 def to_snake self.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').tr("-", "_").downcase end |