Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/ext/string/as_ruby_property.rb

Instance Method Summary collapse

Instance Method Details

#as_ruby_propertyObject


2
3
4
5
6
7
# File 'lib/ext/string/as_ruby_property.rb', line 2

def as_ruby_property
  word = self.dup
  word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
  word.downcase!
  word
end