Class: Grid::Node
- Inherits:
-
Object
- Object
- Grid::Node
- Defined in:
- lib/grid/node.rb
Instance Method Summary collapse
- #command(name, &block) ⇒ Object
-
#initialize ⇒ Node
constructor
A new instance of Node.
- #listen(stdin, address) ⇒ Object
Constructor Details
#initialize ⇒ Node
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 |