Sha256: d2cde2787e2c26e7c03b2be59336b3b594bd57efa7678011e4d59215cff67710

Contents?: true

Size: 1.37 KB

Versions: 7

Compression:

Stored size: 1.37 KB

Contents

module Tap
  module Support

    # Represents a task node in a Schema.
    class Node
      
      # An array of arguments used to instantiate
      # the node
      attr_accessor :argv
      
      # The input or source for the node.  Inputs
      # may be a Join, nil, or an Integer.  An 
      # Integer input indicates that the node should 
      # be enqued to a round using argv as inputs.
      attr_accessor :input
      
      # The output for the node. Output may be a
      # a Join or nil.
      attr_accessor :output

      def initialize(argv=[], input=nil, output=nil)
        @argv = argv
        @input = input
        @output = output
      end
      
      # Resets the source and join to nil.
      def globalize
        self.input = nil
        self.output = nil
      end
      
      # True if the input and output are nil.
      def global?
        input == nil && output == nil
      end
      
      # Returns the round for self; a round is indicated
      # by an integer input.  If input is anything but 
      # an integer, round returns nil.
      def round
        input.kind_of?(Integer) ? input : nil
      end
      
      # Alias for input=
      def round=(input)
        self.input = input
      end
      
      def inspect
        "#<#{self.class}:#{object_id} argv=[#{argv.join(' ')}] input=#{input.inspect} output=#{output.inspect}>"
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
bahuvrihi-tap-0.10.8 lib/tap/support/node.rb
bahuvrihi-tap-0.11.0 lib/tap/support/node.rb
bahuvrihi-tap-0.11.1 lib/tap/support/node.rb
bahuvrihi-tap-0.11.2 lib/tap/support/node.rb
bahuvrihi-tap-0.12.0 lib/tap/support/node.rb
tap-0.11.1 lib/tap/support/node.rb
tap-0.11.0 lib/tap/support/node.rb