module LunaPark::Extensions::Callable

class-level mixin

The Callable interface is a generic interface containing a single `call()` method - which returns a generic value

@example

class MyCallableObject < LunaPark::Extensions::Callable
  def initialize(params)
    @params = params
  end

  def call
    # do some stuff with @params
    'call used'
  end

  def call!
    # do some stuff with @params
    'call! used'
  end
end

MyCallableObject.call(params)  # => 'call used'
MyCallableObject.call!(params) # => 'call! used'

Public Instance Methods

call(*args) click to toggle source

Preferred class method to run instance `call` method

# File lib/luna_park/extensions/callable.rb, line 33
def call(*args)
  new(*args).call
end
call!(*args) click to toggle source

Preferred class method to run instance `call`! method

# File lib/luna_park/extensions/callable.rb, line 39
def call!(*args)
  new(*args).call!
end