Class: Interface::DirectAdapter

Inherits:
Object
  • Object
show all
Extended by:
FactoryMethods
Defined in:
lib/interface/direct_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(callable) ⇒ DirectAdapter

Returns a new instance of DirectAdapter.



6
7
8
# File 'lib/interface/direct_adapter.rb', line 6

def initialize(callable)
  @callable = callable
end

Instance Method Details

#call(*args, &block) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/interface/direct_adapter.rb', line 10

def call(*args, &block)
  unless @callable.respond_to?(:call)
    fail(Interface::Errors::AdaptationError.new("#{@callable.class} is not callable!"))
  end

  @callable.call(*args, &block)
end