class Flowjob::Flow

Attributes

context[R]

Public Class Methods

new(context, options = {}) click to toggle source
# File lib/flowjob/flow.rb, line 23
def initialize(context, options = {})
  @context = context
  @namespace = options[:namespace] || "Flowjob::Actions"
end
run(context, options = {}) { |flow| ... } click to toggle source
# File lib/flowjob/flow.rb, line 8
def self.run(context, options = {})
  flow = new(context, options)
  yield(flow)
end

Public Instance Methods

method_missing(method, *args, &block) click to toggle source
# File lib/flowjob/flow.rb, line 13
def method_missing(method, *args, &block)
  action_class = begin
    "#{@namespace}::#{method.to_s.camelize}".constantize
  rescue
    raise NoActionError, "Unregistered action '#{method}'"
  end
  action = action_class.new(@context)
  action.call(*args)
end