lib/spnet/ports/command_in_port.rb in spnet-0.1.3 vs lib/spnet/ports/command_in_port.rb in spnet-0.1.4

- old
+ new

@@ -4,24 +4,23 @@ class CommandInPort < InPort include Hashmake::HashMakeable ARG_SPECS = [ - Hashmake::ArgSpec.new(:key => :list_commands_handler, :reqd => true, :type => Proc), - Hashmake::ArgSpec.new(:key => :exec_command_handler, :reqd => true, :type => Proc) + Hashmake::ArgSpec.new(:key => :command_map, :reqd => true, :type => Proc, :container => Hashmake::ArgSpec::CONTAINER_HASH), ] def initialize hashed_args hash_make(CommandInPort::ARG_SPECS, hashed_args) hashed_args.merge!(:matching_port_class => CommandOutPort) super(hashed_args) end def list_commands - @list_commands_handler.call + @command_map.keys end def exec_command command, data - @exec_command_handler.call command, data + @command_map[command].call data end end end