Class: SNMP::Integer
- Inherits:
-
Object
show all
- Includes:
- Comparable
- Defined in:
- lib/snmp/varbind.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(value) ⇒ Integer
Returns a new instance of Integer.
65
66
67
|
# File 'lib/snmp/varbind.rb', line 65
def initialize(value)
@value = value.to_i
end
|
Class Method Details
.decode(value_data) ⇒ Object
Instance Method Details
#<=>(other) ⇒ Object
69
70
71
|
# File 'lib/snmp/varbind.rb', line 69
def <=>(other)
@value <=> other.to_i
end
|
#asn1_type ⇒ Object
61
62
63
|
# File 'lib/snmp/varbind.rb', line 61
def asn1_type
"INTEGER"
end
|
#coerce(other) ⇒ Object
73
74
75
76
77
78
79
|
# File 'lib/snmp/varbind.rb', line 73
def coerce(other)
if other.kind_of? Fixnum
return [other, @value]
else
return [other.to_f, self.to_f]
end
end
|
#encode ⇒ Object
93
94
95
|
# File 'lib/snmp/varbind.rb', line 93
def encode
encode_integer(@value)
end
|
#to_f ⇒ Object
89
90
91
|
# File 'lib/snmp/varbind.rb', line 89
def to_f
@value.to_f
end
|
#to_i ⇒ Object
85
86
87
|
# File 'lib/snmp/varbind.rb', line 85
def to_i
@value
end
|
#to_s ⇒ Object
81
82
83
|
# File 'lib/snmp/varbind.rb', line 81
def to_s
@value.to_s
end
|