Class: Pantry::Commands::Echo
- Inherits:
-
Pantry::Command
- Object
- Pantry::Command
- Pantry::Commands::Echo
- Defined in:
- lib/pantry/commands/echo.rb
Overview
Simple Echo command, returns the body of the Message given.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(string_to_echo = "") ⇒ Echo
constructor
A new instance of Echo.
- #perform(message) ⇒ Object
- #receive_client_response(response) ⇒ Object
- #to_message ⇒ Object
Methods inherited from Pantry::Command
command, #finished, #finished?, message_type, #prepare_message, #receive_response, #receive_server_response, #send_request, #send_request!, #server_or_client, #server_or_client=, #wait_for_finish
Constructor Details
#initialize(string_to_echo = "") ⇒ Echo
Returns a new instance of Echo.
11 12 13 |
# File 'lib/pantry/commands/echo.rb', line 11 def initialize(string_to_echo = "") @string_to_echo = string_to_echo end |
Instance Method Details
#perform(message) ⇒ Object
21 22 23 |
# File 'lib/pantry/commands/echo.rb', line 21 def perform() .body[0] end |
#receive_client_response(response) ⇒ Object
25 26 27 |
# File 'lib/pantry/commands/echo.rb', line 25 def receive_client_response(response) Pantry.ui.say("#{response.from} echo's #{response.body[0].inspect}") end |
#to_message ⇒ Object
15 16 17 18 19 |
# File 'lib/pantry/commands/echo.rb', line 15 def = super << @string_to_echo end |