Class: Interface::DefaultAdapter

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

Instance Method Summary collapse

Constructor Details

#initialize(callable) ⇒ DefaultAdapter

Returns a new instance of DefaultAdapter.



6
7
8
# File 'lib/interface/default_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/default_adapter.rb', line 10

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

  _call(*args, &block)
end