Class: Cmdserver::Templates::BasicTemplate
- Inherits:
-
Object
- Object
- Cmdserver::Templates::BasicTemplate
- Defined in:
- lib/cmdserver/templates.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
Instance Method Summary collapse
-
#initialize ⇒ BasicTemplate
constructor
A new instance of BasicTemplate.
Constructor Details
#initialize ⇒ BasicTemplate
Returns a new instance of BasicTemplate.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cmdserver/templates.rb', line 6 def initialize @body = <<TEMPLATE module Cmdserver::Cmdprotocol def self.extend_protocol() # Replace the bellow with your own commands. # Each key is a command your server will accept and # call the Proc or Command associated with it. # 'Command' can also be a class as long as it has a 'call' method @protocol["extension"] = -> client_socket, argument { client_socket.puts "Command recieved" } end # Replace the bellow with your own default 'command not found' action def self.default_action(client_socket, argument) client_socket.puts "No such command: '\#{argument}'" end end TEMPLATE end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
4 5 6 |
# File 'lib/cmdserver/templates.rb', line 4 def body @body end |