Module: Tripleloop::Util::String
- Defined in:
- lib/tripleloop/util.rb
Class Method Summary collapse
Class Method Details
.classify(string) ⇒ Object
20 21 22 23 24 |
# File 'lib/tripleloop/util.rb', line 20 def classify(string) string.split("_").reduce("") { |accu, chunk| accu << chunk.capitalize } end |
.snake_case(string) ⇒ Object
26 27 28 |
# File 'lib/tripleloop/util.rb', line 26 def snake_case(string) string.gsub(/(.)([A-Z])/,'\1_\2').downcase end |