Class: Grid::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/grid/node.rb

Instance Method Summary collapse

Constructor Details

#initializeNode

Returns a new instance of Node.



7
8
9
# File 'lib/grid/node.rb', line 7

def initialize
  @handler = CommandHandler.new
end

Instance Method Details

#command(name, &block) ⇒ Object



17
18
19
# File 'lib/grid/node.rb', line 17

def command(name, &block)
  @handler.register_command(name, &block)
end

#listen(stdin, address) ⇒ Object



11
12
13
14
15
# File 'lib/grid/node.rb', line 11

def listen(stdin, address)
  stdin.listen(address) do |command|
    @handler.on_command(command)
  end
end