Class: Nsqrb::Command
- Inherits:
-
Object
- Object
- Nsqrb::Command
- Defined in:
- lib/nsqrb/command.rb
Defined Under Namespace
Classes: Cls, Fin, Identify, Nop, Pub, Rdy, Req, Sub, Touch
Instance Method Summary collapse
-
#error?(response) ⇒ Boolean
Is response ERROR.
-
#initialize(args = {}) ⇒ Command
constructor
A new instance of Command.
-
#ok?(response) ⇒ Boolean
Is response OK.
- #to_line ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Command
Returns a new instance of Command.
4 5 6 |
# File 'lib/nsqrb/command.rb', line 4 def initialize(args = {}) @args = args end |
Instance Method Details
#error?(response) ⇒ Boolean
Is response ERROR
19 20 21 22 |
# File 'lib/nsqrb/command.rb', line 19 def error?(response) response = response.content if response.is_a?(FrameType) self.class.error.include?(response) end |
#ok?(response) ⇒ Boolean
Is response OK
13 14 15 16 |
# File 'lib/nsqrb/command.rb', line 13 def ok?(response) response = response.content if response.is_a?(FrameType) self.class.ok.include?(response) end |
#to_line ⇒ Object
8 9 10 |
# File 'lib/nsqrb/command.rb', line 8 def to_line "#{command}\n" end |