Class: WampRails::Command::BaseCommand
- Inherits:
-
Object
- Object
- WampRails::Command::BaseCommand
- Defined in:
- lib/wamp_rails/commands/base_command.rb
Direct Known Subclasses
Defined Under Namespace
Classes: CallbackArgs
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#queue ⇒ Object
Returns the value of attribute queue.
Instance Method Summary collapse
-
#callback(result, error, details) ⇒ Object
Used in sub-classes to handle the response.
-
#execute ⇒ Object
Executes the command.
-
#initialize(client) ⇒ BaseCommand
constructor
A new instance of BaseCommand.
-
#session ⇒ Object
Returns the session from the client.
Constructor Details
#initialize(client) ⇒ BaseCommand
Returns a new instance of BaseCommand.
16 17 18 19 |
# File 'lib/wamp_rails/commands/base_command.rb', line 16 def initialize(client) self.queue = Queue.new self.client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/wamp_rails/commands/base_command.rb', line 4 def client @client end |
#queue ⇒ Object
Returns the value of attribute queue.
4 5 6 |
# File 'lib/wamp_rails/commands/base_command.rb', line 4 def queue @queue end |
Instance Method Details
#callback(result, error, details) ⇒ Object
Used in sub-classes to handle the response
33 34 35 |
# File 'lib/wamp_rails/commands/base_command.rb', line 33 def callback(result, error, details) self.queue.push(CallbackArgs.new(result, error, details)) end |
#execute ⇒ Object
Executes the command. This is called by the library in the EM Thread
28 29 30 |
# File 'lib/wamp_rails/commands/base_command.rb', line 28 def execute # Override when sub classing end |
#session ⇒ Object
Returns the session from the client
22 23 24 |
# File 'lib/wamp_rails/commands/base_command.rb', line 22 def session self.client.wamp.session end |