Module: WordifyTdvs
- Defined in:
- lib/wordify_tdvs.rb,
lib/wordify_tdvs/version.rb
Constant Summary collapse
- VERSION =
"0.2.0"
Class Method Summary collapse
- .caseify(str) ⇒ Object
- .random_day ⇒ Object
- .reversify(str) ⇒ Object
- .spaceify(str, spaces = 0) ⇒ Object
Class Method Details
.caseify(str) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# 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 ⇒ Object
28 29 30 |
# File 'lib/wordify_tdvs.rb', line 28 def self.random_day ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'].sample end |
.reversify(str) ⇒ Object
4 5 6 7 8 9 10 |
# 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) ⇒ Object
22 23 24 25 26 |
# 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 |