Class: SPNet::OutPort

Inherits:
Object
  • Object
show all
Includes:
Hashmake::HashMakeable
Defined in:
lib/spnet/core/out_port.rb

Overview

A port that is used to exercise some functionality exposed by an InPort.

Author:

  • James Tunnell

Direct Known Subclasses

CommandOutPort, ParamOutPort, SignalOutPort

Constant Summary collapse

ARG_SPECS =

Define ArgSpec’s to use in processing hashed arguments during #initialize.

{
  :matching_class => arg_spec(:reqd => true, :type => Class),
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ OutPort

A new instance of OutPort.

Parameters:

  • args (Hash)

    Hashed arguments for initialization. See OutPort::ARG_SPECS for details.



19
20
21
22
# File 'lib/spnet/core/out_port.rb', line 19

def initialize args
  hash_make args, OutPort::ARG_SPECS
  @link = nil
end

Instance Attribute Details

Returns the value of attribute link.



14
15
16
# File 'lib/spnet/core/out_port.rb', line 14

def link
  @link
end

#matching_classObject (readonly)

Returns the value of attribute matching_class.



14
15
16
# File 'lib/spnet/core/out_port.rb', line 14

def matching_class
  @matching_class
end

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/spnet/core/out_port.rb', line 14

def name
  @name
end

Instance Method Details

Set @link to nil.



31
32
33
# File 'lib/spnet/core/out_port.rb', line 31

def clear_link
  @link = nil
end

#linked?Boolean

Return true if @link is not nil.

Returns:

  • (Boolean)


36
37
38
# File 'lib/spnet/core/out_port.rb', line 36

def linked?
  !link.nil?
end

Set @link to the given Link object.

Raises:

  • (ArgumentError)


25
26
27
28
# File 'lib/spnet/core/out_port.rb', line 25

def set_link link
  raise ArgumentError, "link 'from' port is not self" unless link.from == self
  @link = link
end