Class: Decorate::BlockDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/decorate.rb

Overview

A BlockDecorator instance wraps an object (block) and delegates calls to decorate to the wrapped objects call method.

Instance Method Summary collapse

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