Module: ApiUtils
- Included in:
- ZohoApi
- Defined in:
- lib/api_utils.rb
Class Method Summary collapse
- .camelize_with_space(str) ⇒ Object
- .string_to_method_name(s) ⇒ Object
- .string_to_symbol(s) ⇒ Object
- .symbol_to_string(sym) ⇒ Object
Class Method Details
.camelize_with_space(str) ⇒ Object
5 6 7 |
# File 'lib/api_utils.rb', line 5 def self.camelize_with_space(str) str.split('_').map {|w| w.capitalize}.join(' ') end |
.string_to_method_name(s) ⇒ Object
9 10 11 |
# File 'lib/api_utils.rb', line 9 def self.string_to_method_name(s) s.gsub(' ', '_').downcase end |
.string_to_symbol(s) ⇒ Object
13 14 15 16 |
# File 'lib/api_utils.rb', line 13 def self.string_to_symbol(s) s.gsub!(/[()%]*/, '') s.gsub(' ', '_').downcase.to_sym end |
.symbol_to_string(sym) ⇒ Object
18 19 20 |
# File 'lib/api_utils.rb', line 18 def self.symbol_to_string(sym) sym.class == Symbol ? self.camelize_with_space(sym.to_s) : self.camelize_with_space(sym) end |