Module: WordifyAmyeisenmenger
- Defined in:
- lib/wordify_amyeisenmenger.rb,
lib/wordify_amyeisenmenger/version.rb
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
Class Method Details
.casify(string) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/wordify_amyeisenmenger.rb', line 8 def self.casify(string) to_case = [:upcase, :downcase] arr = string.split("") arr.each_with_index do |letter, i| arr[i] = letter.send(to_case.sample) end arr.join("") end |
.reversify(string) ⇒ Object
4 5 6 |
# File 'lib/wordify_amyeisenmenger.rb', line 4 def self.reversify(string) string.split("").reverse.join("") end |
.spacify(string, spaces = 0) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/wordify_amyeisenmenger.rb', line 17 def self.spacify(string, spaces = 0) new_string = string spaces.times do new_string = new_string.split("").join(" ") end new_string end |