module BatchKit::ActsAsSequence

When included into a class, marks the class as a BatchKit sequence. The including class has the following class methods added, which act as a DSL for specifying the sequence properties and behaviour:

Instances of the including class also get the following instance methods:

Public Class Methods

included(base) click to toggle source

Hook used to extend the including class with class methods defined in the ActsAsSequence::ClassMethods module.

Creates a Sequence::Definition object to hold details of the sequence, and stores it away in a @__sequence__ class instance variable.

# File lib/batch-kit/framework/acts_as_sequence.rb, line 94
def self.included(base)
    base.extend(ClassMethods)
    caller.find{ |f| !(f =~ /batch.framework/) } =~ /^((?:[a-zA-Z]:)?[^:]+)/
    sequence_file = File.realpath($1)
    sequence_defn = Sequence::Definition.new(base, sequence_file)
    base.instance_variable_set :@__sequence__, sequence_defn
end

Public Instance Methods

parallel() { || ... } click to toggle source
# File lib/batch-kit/framework/acts_as_sequence.rb, line 103
def parallel
    # TODO: Implement running contents of block in parallel
    yield
end
sequence() click to toggle source

@return [Sequence::Definition] The SequenceDefinition for this Sequence instance.

# File lib/batch-kit/framework/acts_as_sequence.rb, line 110
def sequence
    self.class.sequence_definition
end
sequence_run() click to toggle source

@return [Sequence::Run] The SequenceRun for this Sequence instance.

# File lib/batch-kit/framework/acts_as_sequence.rb, line 116
def sequence_run
    @__sequence_run__
end