Module: ShareCount::StringHelper

Included in:
ShareCount, Base
Defined in:
lib/share_count/string_helper.rb

Instance Method Summary collapse

Instance Method Details

#to_camel_case(str) ⇒ Object



7
8
9
# File 'lib/share_count/string_helper.rb', line 7

def to_camel_case(str)
  str.split('_').map(&:capitalize).join
end

#to_underscore(str) ⇒ Object



3
4
5
# File 'lib/share_count/string_helper.rb', line 3

def to_underscore(str)
  str.dup.tap { |s| (s.gsub!(/(.)([A-Z])/,'\1_\2') || s).downcase! }
end