Module: Utilise::Augment::Modify

Included in:
String, Symbol
Defined in:
lib/utilise/augment/modify.rb

Overview

Extends classes that could be modified

Instance Method Summary collapse

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

#kebabObject

Returns a string in kebab case



27
28
29
# File 'lib/utilise/augment/modify.rb', line 27

def kebab
  split_up.join('-')
end

#snakeObject

Return a string in snake case



17
18
19
# File 'lib/utilise/augment/modify.rb', line 17

def snake
  split_up.join('_')
end

#spaceObject

Return a string in regular space case



22
23
24
# File 'lib/utilise/augment/modify.rb', line 22

def space
  split_up.join(' ')
end