Class: SNMP::Open::Parser::ValueParser
- Inherits:
-
Object
- Object
- SNMP::Open::Parser::ValueParser
- Includes:
- Constants
- Defined in:
- lib/snmp/open/parser/value_parser.rb
Overview
base class for value parsers
Direct Known Subclasses
Bits, Default, HexString, Integer, NoSuchInstance, NoSuchObject, Other, Stop, Timeticks
Defined Under Namespace
Classes: Bits, Default, HexString, Integer, NoSuchInstance, NoSuchObject, Other, Stop, Timeticks
Constant Summary collapse
- KNOWN_TOKENS =
class NoSuchObject < ValueParser
{ NOSUCHINSTANCE_STR => NoSuchInstance, NOSUCHOBJECT_STR => NoSuchObject, NOMOREVARIABLES_STR => Stop }.freeze
- KNOWN_TYPES =
{ nil => Default, 'BITS' => Bits, 'INTEGER' => ValueParser::Integer, 'Gauge32' => ValueParser::Integer, 'Gauge64' => ValueParser::Integer, 'Counter32' => ValueParser::Integer, 'Counter64' => ValueParser::Integer, 'Hex-STRING' => HexString, 'Timeticks' => Timeticks }.freeze
Constants included from Constants
Constants::NOMOREVARIABLES_STR, Constants::NOSUCHINSTANCE_STR, Constants::NOSUCHOBJECT_STR
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, token) ⇒ ValueParser
constructor
A new instance of ValueParser.
- #parse ⇒ Object
Constructor Details
#initialize(type, token) ⇒ ValueParser
Returns a new instance of ValueParser.
13 14 15 16 |
# File 'lib/snmp/open/parser/value_parser.rb', line 13 def initialize(type, token) @type = type @token = token end |
Class Method Details
.find(type, token) ⇒ Object
8 9 10 11 |
# File 'lib/snmp/open/parser/value_parser.rb', line 8 def self.find(type, token) cls = KNOWN_TOKENS[token] || KNOWN_TYPES[type] || Other cls.new(type, token) end |
Instance Method Details
#parse ⇒ Object
18 19 20 |
# File 'lib/snmp/open/parser/value_parser.rb', line 18 def parse(*) @parse end |