class Rootage::ProcessContext

‘ProcessContext` is a context for processes. Each process is evaluated in this context object.

Attributes

model[R]
scenario[R]

Public Class Methods

make(&block) click to toggle source

Make a subclass.

# File lib/rootage/core.rb, line 433
def self.make(&block)
  klass = Class.new(self)
  klass.instance_exec(&block)
  return klass
end
new(scenario) click to toggle source

@param scenario [Scenario]

a scenario that owns this process
# File lib/rootage/core.rb, line 444
def initialize(scenario)
  @scenario = scenario
  @model = scenario.model
end

Public Instance Methods

fail() click to toggle source

Fail the process.

# File lib/rootage/core.rb, line 456
def fail
  throw :rootage_process_failure, false
end
test(val) click to toggle source

Test the value. If it is false or nil, the action firing ends. Otherwise, return itself.

# File lib/rootage/core.rb, line 451
def test(val)
  val ? val : fail
end