Class: Bixby::CommandResponse
- Inherits:
-
Object
- Object
- Bixby::CommandResponse
- Includes:
- Jsonify
- Defined in:
- lib/bixby_common/command_response.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
Returns the value of attribute status.
-
#stderr ⇒ Object
Returns the value of attribute stderr.
-
#stdout ⇒ Object
Returns the value of attribute stdout.
Instance Method Summary collapse
- #decode ⇒ Object
- #decode_stderr ⇒ Object
- #error? ⇒ Boolean
-
#initialize(params = nil) ⇒ CommandResponse
constructor
A new instance of CommandResponse.
- #success? ⇒ Boolean
Methods included from Jsonify
Methods included from Hashify
Constructor Details
#initialize(params = nil) ⇒ CommandResponse
Returns a new instance of CommandResponse.
9 10 11 12 |
# File 'lib/bixby_common/command_response.rb', line 9 def initialize(params = nil) return if params.nil? or params.empty? params.each{ |k,v| self.send("#{k}=", v) if self.respond_to? "#{k}=" } end |
Instance Attribute Details
#status ⇒ Object
Returns the value of attribute status.
7 8 9 |
# File 'lib/bixby_common/command_response.rb', line 7 def status @status end |
#stderr ⇒ Object
Returns the value of attribute stderr.
7 8 9 |
# File 'lib/bixby_common/command_response.rb', line 7 def stderr @stderr end |
#stdout ⇒ Object
Returns the value of attribute stdout.
7 8 9 |
# File 'lib/bixby_common/command_response.rb', line 7 def stdout @stdout end |
Instance Method Details
#decode ⇒ Object
22 23 24 |
# File 'lib/bixby_common/command_response.rb', line 22 def decode MultiJson.load(@stdout) end |
#decode_stderr ⇒ Object
26 27 28 |
# File 'lib/bixby_common/command_response.rb', line 26 def decode_stderr MultiJson.load(@stderr) end |
#error? ⇒ Boolean
18 19 20 |
# File 'lib/bixby_common/command_response.rb', line 18 def error? not success? end |
#success? ⇒ Boolean
14 15 16 |
# File 'lib/bixby_common/command_response.rb', line 14 def success? @status.to_i == 0 end |