Class: SNMP::Open::Parser::ValueParser::HexString
- Inherits:
-
SNMP::Open::Parser::ValueParser
- Object
- SNMP::Open::Parser::ValueParser
- SNMP::Open::Parser::ValueParser::HexString
- Defined in:
- lib/snmp/open/parser/value_parser.rb
Overview
parses objects identified like ‘= Hex-STRING:’
Constant Summary
Constants inherited from SNMP::Open::Parser::ValueParser
Constants included from Constants
Constants::NOMOREVARIABLES_STR, Constants::NOSUCHINSTANCE_STR, Constants::NOSUCHOBJECT_STR
Instance Method Summary collapse
Methods inherited from SNMP::Open::Parser::ValueParser
Constructor Details
This class inherits a constructor from SNMP::Open::Parser::ValueParser
Instance Method Details
#parse(tokens) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/snmp/open/parser/value_parser.rb', line 53 def parse(tokens) return @parse if @parse bytes = [] loop do break unless tokens.peek =~ /\A[0-9A-Za-z]{2}\z/ bytes << tokens.next end string = bytes.map { |b| b.to_i(16).chr }.join @parse = [@type, string] end |