module WordifyZimmerman

Constants

VERSION

Public Class Methods

caseify(str) click to toggle source
# File lib/wordify_zimmerman.rb, line 12
def self.caseify(str)
  the_case = [:downcase, :upcase]
  letters = str.split("")
  letters.each_with_index do |letter, i|
    this_case = the_case.sample
    letters[i] = letter.send(this_case)
  end
  letters.join('')
end
reversify(str) click to toggle source
# File lib/wordify_zimmerman.rb, line 4
def self.reversify(str)
  reversed_string = ''
  (str.length-1).downto(0).each do |n|
    reversed_string << str[n]
  end
  reversed_string
end
spaceify(str, spaces = 0) click to toggle source
# File lib/wordify_zimmerman.rb, line 22
def self.spaceify(str, spaces = 0)
  new_string = str
  spaces.times { new_string = new_string.split("").join(" ") } #do features is the same as using the curly brackets.
  new_string
end