Module: Mockingcase
- Included in:
- String
- Defined in:
- lib/mockingcase.rb,
lib/mockingcase/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
Instance Method Details
#to_mockingcase(random = false) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mockingcase.rb', line 4 def to_mockingcase random = false state = false new = [] self.chars.each do |c| if random then state = [true, false].sample end if state then new << c.upcase else new << c.downcase end state = ! state end new.join end |
#to_mockingcase!(random = false) ⇒ Object
20 21 22 23 |
# File 'lib/mockingcase.rb', line 20 def to_mockingcase! random = false replace self.to_mockingcase random nil end |