Class: Snmpjr::Response
- Inherits:
-
Object
- Object
- Snmpjr::Response
- Defined in:
- lib/snmpjr/response.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#oid ⇒ Object
readonly
Returns the value of attribute oid.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #error? ⇒ Boolean
-
#initialize(response = {}) ⇒ Response
constructor
A new instance of Response.
- #to_s ⇒ Object
Constructor Details
#initialize(response = {}) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 |
# File 'lib/snmpjr/response.rb', line 5 def initialize response = {} @error = response[:error] || '' @value = response[:value] || '' @oid = response[:oid] || '' end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
3 4 5 |
# File 'lib/snmpjr/response.rb', line 3 def error @error end |
#oid ⇒ Object (readonly)
Returns the value of attribute oid.
3 4 5 |
# File 'lib/snmpjr/response.rb', line 3 def oid @oid end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 26 |
# File 'lib/snmpjr/response.rb', line 23 def ==(other) return false unless other.instance_of?(self.class) @error == other.error && to_s == other.to_s && @oid == other.oid end |
#error? ⇒ Boolean
11 12 13 14 15 16 17 |
# File 'lib/snmpjr/response.rb', line 11 def error? if @error.empty? false else true end end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/snmpjr/response.rb', line 19 def to_s @value end |