module WordifyTdvs

Constants

VERSION

Public Class Methods

caseify(str) click to toggle source
# File lib/wordify_tdvs.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
random_day() click to toggle source
# File lib/wordify_tdvs.rb, line 28
def self.random_day
  ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'].sample
end
reversify(str) click to toggle source
# File lib/wordify_tdvs.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_tdvs.rb, line 22
def self.spaceify(str, spaces = 0)
  new_string = str
  spaces.times { new_string.split("").join(" ") }
  new_string
end