Module: QML::NameHelper

Defined in:
lib/qml/name_helper.rb

Class Method Summary collapse

Class Method Details

.to_underscore(sym) ⇒ Object



5
6
7
# File 'lib/qml/name_helper.rb', line 5

def to_underscore(sym)
  sym.to_s.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase.to_sym
end

.to_upper_underscore(sym) ⇒ Object



8
9
10
# File 'lib/qml/name_helper.rb', line 8

def to_upper_underscore(sym)
  to_underscore(sym).upcase
end