Class: Decorate::BlockDecorator
Overview
A BlockDecorator instance wraps an object (block
) and delegates calls to decorate
to the wrapped objects call
method.
Instance Method Summary collapse
- #decorate(klass, method_name) ⇒ Object
-
#initialize(block) ⇒ BlockDecorator
constructor
A new instance of BlockDecorator.
Constructor Details
#initialize(block) ⇒ BlockDecorator
Returns a new instance of BlockDecorator.
9 10 11 |
# File 'lib/decorate.rb', line 9 def initialize(block) @block = block end |
Instance Method Details
#decorate(klass, method_name) ⇒ Object
13 14 15 |
# File 'lib/decorate.rb', line 13 def decorate(klass, method_name) @block.call(klass, method_name) end |