Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/windcave_rest/models/base.rb
Overview
to convert from snake case to camel case in String
Instance Method Summary collapse
Instance Method Details
#camel_case ⇒ Object
144 145 146 147 |
# File 'lib/windcave_rest/models/base.rb', line 144 def camel_case return self if self !~ /_/ && self =~ /[A-Z]+.*/ split('_').map{|e| e.capitalize}.join end |
#camel_case_lower ⇒ Object
149 150 151 |
# File 'lib/windcave_rest/models/base.rb', line 149 def camel_case_lower self.split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join end |