class Actor::Build

Attributes

arguments[R]
block[R]
cls[R]

Public Class Methods

call(cls, *arguments, &block) click to toggle source
# File lib/actor/build.rb, line 13
def self.call cls, *arguments, &block
  instance = new cls, arguments, &block
  instance.()
end
new(cls, arguments, &block) click to toggle source
# File lib/actor/build.rb, line 7
def initialize cls, arguments, &block
  @arguments = arguments
  @block = block
  @cls = cls
end

Public Instance Methods

call() click to toggle source
# File lib/actor/build.rb, line 18
def call
  if cls.respond_to? :build
    method = cls.method :build
  else
    method = cls.method :new
  end

  if block
    actor = method.(*arguments, &block)
  else
    actor = method.(*arguments)
  end

  actor.configure

  actor
end