Class: Net::BER::BerIdentifiedOid
- Inherits:
-
Object
- Object
- Net::BER::BerIdentifiedOid
- Defined in:
- lib/net/ber.rb
Instance Attribute Summary collapse
-
#ber_identifier ⇒ Object
Returns the value of attribute ber_identifier.
Instance Method Summary collapse
-
#initialize(oid) ⇒ BerIdentifiedOid
constructor
A new instance of BerIdentifiedOid.
- #to_ber ⇒ Object
Constructor Details
#initialize(oid) ⇒ BerIdentifiedOid
Returns a new instance of BerIdentifiedOid.
62 63 64 65 66 67 |
# File 'lib/net/ber.rb', line 62 def initialize oid if oid.is_a?(String) oid = oid.split(/\./).map {|s| s.to_i } end @value = oid end |
Instance Attribute Details
#ber_identifier ⇒ Object
Returns the value of attribute ber_identifier.
61 62 63 |
# File 'lib/net/ber.rb', line 61 def ber_identifier @ber_identifier end |
Instance Method Details
#to_ber ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/net/ber.rb', line 68 def to_ber # Provisional implementation. # We ASSUME that our incoming value is an array, and we # use the Array#to_ber_oid method defined below. # We probably should obsolete that method, actually, in # and move the code here. # WE ARE NOT CURRENTLY ENCODING THE BER-IDENTIFIER. # This implementation currently hardcodes 6, the universal OID tag. ary = @value.dup first = ary.shift raise Net::BER::BerError.new(" invalid OID" ) unless [0,1,2].include?(first) first = first * 40 + ary.shift ary.unshift first oid = ary.pack("w*") [6, oid.length].pack("CC") + oid end |