Class: CommandPost::StringUtil
- Inherits:
-
Object
- Object
- CommandPost::StringUtil
- Defined in:
- lib/command_post/util/string_util.rb
Class Method Summary collapse
Class Method Details
.to_camel_case(field, upcase) ⇒ Object
6 7 8 9 |
# File 'lib/command_post/util/string_util.rb', line 6 def self.to_camel_case(field, upcase) string = field.to_s upcase == true ? string.upcase : string.split('_').collect{|x| x.slice(0,1).capitalize + x.slice(1..-1) }.join() end |
.to_label(field, upcase) ⇒ Object
11 12 13 14 |
# File 'lib/command_post/util/string_util.rb', line 11 def self.to_label(field, upcase) string = field.to_s upcase == true ? string.upcase : string.split('_').collect{|x| x.slice(0,1).capitalize + x.slice(1..-1) }.join(' ') end |