Class: SPNet::CommandOutPort
- Defined in:
- lib/spnet/ports/command_out_port.rb
Overview
Execute commands for a connected CommandInPort object.
Constant Summary
Constants inherited from OutPort
Instance Attribute Summary
Attributes inherited from OutPort
Instance Method Summary collapse
-
#exec_command(command, data = nil) ⇒ Object
If linked, return the result of calling the connected CommandInPort object’s exec_command method.
-
#initialize ⇒ CommandOutPort
constructor
A new instance of CommandOutPort.
-
#list_commands ⇒ Object
If linked, return the result of calling the connected CommandInPort object’s list_commands method.
Methods inherited from OutPort
#clear_link, #linked?, #set_link
Constructor Details
#initialize ⇒ CommandOutPort
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_commands ⇒ Object
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 |