Class: SPNet::CommandOutPort

Inherits:
OutPort
  • Object
show all
Defined in:
lib/spnet/ports/command_out_port.rb

Overview

Execute commands for a connected CommandInPort object.

Author:

  • James Tunnell

Constant Summary

Constants inherited from OutPort

OutPort::ARG_SPECS

Instance Attribute Summary

Attributes inherited from OutPort

#link, #matching_class, #name

Instance Method Summary collapse

Methods inherited from OutPort

#clear_link, #linked?, #set_link

Constructor Details

#initializeCommandOutPort

A new instance of CommandOutPort.



9
10
11
# File 'lib/spnet/ports/command_out_port.rb', line 9

def initialize
  super(:matching_class => CommandInPort)
end

Instance Method Details

#exec_command(command, data = nil) ⇒ Object

If linked, return the result of calling the connected CommandInPort object’s exec_command method. Otherwise, return false.



24
25
26
27
28
29
# File 'lib/spnet/ports/command_out_port.rb', line 24

def exec_command command, data = nil
  unless @link.nil?
    return @link.to.exec_command(command, data)
  end
  return false
end

#list_commandsObject

If linked, return the result of calling the connected CommandInPort object’s list_commands method. Otherwise, return false.



15
16
17
18
19
20
# File 'lib/spnet/ports/command_out_port.rb', line 15

def list_commands
  unless @link.nil?
    return @link.to.list_commands
  end
  return false
end