Sha256: 5e92a2351f8c6bfedae11579efe42ab920d41ded43866085ecab381c378c7037
Contents?: true
Size: 881 Bytes
Versions: 3
Compression:
Stored size: 881 Bytes
Contents
module SPNet # A port that exposes some functionality in a block. # # @author James Tunnell class InPort include Hashmake::HashMakeable # Define ArgSpec's to use in processing hashed arguments during #initialize. ARG_SPECS = { :matching_class => arg_spec(:reqd => true, :type => Class), } attr_reader :link, :matching_class # A new instance of InPort. # @param [Hash] args Hashed arguments for initialization. See InPort::ARG_SPECS # for details. def initialize args hash_make InPort::ARG_SPECS, args @link = nil end # Set @link to the given Link object. def set_link link raise ArgumentError, "link 'to' port is not self" unless link.to == self @link = link end # Set @link to nil. def clear_link @link = nil end # Return true if @link is not nil. def linked? !link.nil? end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spnet-0.1.7 | lib/spnet/core/in_port.rb |
spnet-0.1.6 | lib/spnet/core/in_port.rb |
spnet-0.1.5 | lib/spnet/core/in_port.rb |