Module: Osmer::Utils

Included in:
Osmer, Schema::Custom::Table::Dsl
Defined in:
lib/osmer.rb

Instance Method Summary collapse

Instance Method Details

#camelize(str) ⇒ Object



11
12
13
# File 'lib/osmer.rb', line 11

def camelize(str)
  str.to_s.gsub(/\/(.?)/){ "::" + $1.upcase }.gsub(/(^|_)(.)/){ $2.upcase }
end

#underscore(str) ⇒ Object



15
16
17
# File 'lib/osmer.rb', line 15

def underscore(str)
  str.to_s.gsub(/::(.?)/){ "/" + $1.downcase }.gsub(/(.)([A-Z])/){ "#{$1}_#{$2.downcase}" }.downcase
end