Sha256: aab046d6fa1e48a5ecf6e85e06a29bb421ae4ef49f3af77fb3b1d50104495e7c

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

module Hanuman
  class Stage
    include Gorillib::Builder
    alias_method :configure, :receive!

    magic      :name,    Symbol,         :doc => 'name for this stage; should be unique among other stages on its containing graph', :tester => true
    field      :owner,   Whatever,       :doc => 'the graph this stage sits in'
    magic      :doc,     String,         :doc => 'freeform description of this stage type'

    # @returns the stage, namespaced by the graph that owns it
    def fullname
      [owner.try(:fullname), name].compact.join('.')
    end

    def self.handle
      Gorillib::Inflector.underscore(Gorillib::Inflector.demodulize(self.name))
    end

    #
    # Methods
    #

    # Called after the graph is constructed, before the flow is run
    def setup
    end

    # Called to signal the flow should stop. Close any open connections, flush
    # buffers, stop supervised projects, etc.
    def stop
    end

    def lookup(stage)
      owner.lookup(stage)
    end

    #
    # Graph connections
    #

    def notify(msg)
      true
    end

    def report
      self.attributes
    end

    def to_key()      name   ; end
    def key_method() :name ; end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wukong-3.0.0.pre lib/hanuman/stage.rb