Class: Scrumbler
- Inherits:
-
Object
- Object
- Scrumbler
- Defined in:
- lib/scrumbler.rb
Instance Attribute Summary collapse
-
#original ⇒ Object
readonly
Returns the value of attribute original.
-
#scrumbled ⇒ Object
readonly
Returns the value of attribute scrumbled.
Class Method Summary collapse
Instance Method Summary collapse
- #enscrumble ⇒ Object
-
#initialize(new_string) ⇒ Scrumbler
constructor
A new instance of Scrumbler.
Constructor Details
#initialize(new_string) ⇒ Scrumbler
Returns a new instance of Scrumbler.
12 13 14 15 |
# File 'lib/scrumbler.rb', line 12 def initialize(new_string) @original = new_string @scrumbled = enscrumble end |
Instance Attribute Details
#original ⇒ Object (readonly)
Returns the value of attribute original.
2 3 4 |
# File 'lib/scrumbler.rb', line 2 def original @original end |
#scrumbled ⇒ Object (readonly)
Returns the value of attribute scrumbled.
2 3 4 |
# File 'lib/scrumbler.rb', line 2 def scrumbled @scrumbled end |
Class Method Details
.release_the_monkeys! ⇒ Object
8 9 10 |
# File 'lib/scrumbler.rb', line 8 def self.release_the_monkeys! String.class_eval("def scrumble; Scrumbler.scrumble(self); end") end |
.scrumble(new_string) ⇒ Object
4 5 6 |
# File 'lib/scrumbler.rb', line 4 def self.scrumble(new_string) self.new(new_string).enscrumble end |
Instance Method Details
#enscrumble ⇒ Object
17 18 19 |
# File 'lib/scrumbler.rb', line 17 def enscrumble @original.split(' ').map{ |x| word_scrumble(x) }.join(' ') end |