Class: WindUp::Delegator

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/wind_up/delegator.rb

Instance Method Summary collapse

Instance Method Details

#perform_with(delegatee, *args) ⇒ Object

Instantiate the referenced class and run the #perform action

Parameters:

  • delegatee (Class)

    the class to delegate to

Returns:

  • (Object)

    the return value of the action

Raises:



44
45
46
47
48
# File 'lib/wind_up/delegator.rb', line 44

def perform_with(delegatee, *args)
  handler = delegatee.new
  raise InvalidDelegatee, "#{delegatee} does not have a #perform method defined" unless handler.respond_to?(:perform)
  handler.perform *args
end