Module: WordsWithDave
- Defined in:
- lib/words_with_dave.rb,
lib/words_with_dave/version.rb
Defined Under Namespace
Modules: Greeting
Constant Summary collapse
- VERSION =
"1.0.0"
Class Method Summary collapse
Class Method Details
.casify(str) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/words_with_dave.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.sample arr[i] = letter.send(this_case) end arr.join("") end |
.reversify(str, radix) ⇒ Object
4 5 6 |
# File 'lib/words_with_dave.rb', line 4 def self.reversify(str, radix) str.split('').reverse.join('') end |
.spacify(str, spaces = 0) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/words_with_dave.rb', line 18 def self.spacify(str, spaces = 0) spaces.times do str = str.split("").join(" ") end str end |