Sha256: a08bce9354ed129ef26855b516b72288a20ab9f4f58dd6e6a807e4e556da955b

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

require "wordify_barela/version"

module WordifyBarela
  def self.reversify(str)
    reversed_string = ''
    (str.length-1).downto(0).each do |n|
      reversed_string << str[n]
    end
    reversed_string
  end

  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

  def self.spaceify(str, spaces = 0)
    new_string = str
    spaces.times { new_string = new_string.split("").join(" ") }
    new_string
  end

  def self.random_day
    ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'].sample 
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wordify_barela-0.2.0 lib/wordify_barela.rb