Method: LhStringThing.casify

Defined in:
lib/lh_string_thing.rb

.casify(str) ⇒ Object



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

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