Class: Interface::Adapter

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

Constant Summary collapse

CallingError =
Class.new(StandardError)
InterfaceError =
Class.new(StandardError)

Instance Method Summary collapse

Constructor Details

#initialize(callable) ⇒ Adapter

Returns a new instance of Adapter.



10
11
12
# File 'lib/interface/adapter.rb', line 10

def initialize(callable)
  @callable = callable
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
# File 'lib/interface/adapter.rb', line 14

def call
  unless callable.respond_to?(:call)
    fail(InterfaceError("#{callable.class} is not callable!"))
  end

  _call
end