Module: WordifyJimibue

Defined in:
lib/wordify_jimibue.rb,
lib/wordify_jimibue/version.rb

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.casify(str) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/wordify_jimibue.rb', line 9

def self.casify(str)
	to_case = [:upcase, :downcase]
	arr = str.split('')
	arr.each_with_index do |letter, i|
		arr[i] = letter.send(to_case.sample)
	end
	arr.join('')
end

.reversify(str) ⇒ Object



5
6
7
# File 'lib/wordify_jimibue.rb', line 5

def self.reversify(str)
	str.split(' ').reverse.join('')
end

.spacify(str, spaces = 0) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/wordify_jimibue.rb', line 18

def self.spacify(str, spaces = 0)
 	new_string = str
 	spaces.times do 
 		new_string = new_string.split('').join(' ')
 	end

 	new_string
end