Module: Utilise::Augment::Modify
Overview
Extends classes that could be modified
Instance Method Summary collapse
-
#camel(first_letter = :upper) ⇒ Object
Return a string in modified camel case.
-
#kebab ⇒ Object
Returns a string in kebab case.
-
#snake ⇒ Object
Return a string in snake case.
-
#space ⇒ Object
Return a string in regular space case.
Instance Method Details
#camel(first_letter = :upper) ⇒ Object
Return a string in modified camel case
6 7 8 9 10 11 12 13 14 |
# File 'lib/utilise/augment/modify.rb', line 6 def camel(first_letter = :upper) array = split_up case first_letter when :upper array.map(&:capitalize).join when :lower array.first + array[1..-1].map(&:capitalize).join end end |
#kebab ⇒ Object
Returns a string in kebab case
27 28 29 |
# File 'lib/utilise/augment/modify.rb', line 27 def kebab split_up.join('-') end |
#snake ⇒ Object
Return a string in snake case
17 18 19 |
# File 'lib/utilise/augment/modify.rb', line 17 def snake split_up.join('_') end |
#space ⇒ Object
Return a string in regular space case
22 23 24 |
# File 'lib/utilise/augment/modify.rb', line 22 def space split_up.join(' ') end |