lib/spnet/ports/command_out_port.rb in spnet-0.1.4 vs lib/spnet/ports/command_out_port.rb in spnet-0.1.5
- old
+ new
@@ -1,26 +1,32 @@
module SPNet
+
+# Execute commands for a connected CommandInPort object.
+#
+# @author James Tunnell
class CommandOutPort < OutPort
- def initialize hashed_args = {}
- hashed_args.merge!(:matching_port_class => CommandInPort)
- super(hashed_args)
+ # A new instance of CommandOutPort.
+ def initialize
+ super(:matching_class => CommandInPort)
end
+ # If linked, return the result of calling the connected CommandInPort object's
+ # list_commands method. Otherwise, return false.
def list_commands
- rvs = []
- @links.each do |link|
- rvs.push link.list_commands
+ unless @link.nil?
+ return @link.to.list_commands
end
- return rvs
+ return false
end
+ # If linked, return the result of calling the connected CommandInPort object's
+ # exec_command method. Otherwise, return false.
def exec_command command, data = nil
- rvs = []
- @links.each do |link|
- rvs.push link.exec_command(command, data)
+ unless @link.nil?
+ return @link.to.exec_command(command, data)
end
- return rvs
+ return false
end
end
end
\ No newline at end of file