# coding: ASCII-8BIT class ASN1Kit::RelativeOID < ASN1Kit::Type asn1_tag :IMPLICIT, :UNIVERSAL, 13 asn1_alias "RELATIVE-OID" attr_reader :components def initialize(components) @components = components end def dot_notation @components.join(".") end def self.from_dot_notation(string) new(string.split(".").map { |s| Integer(s) }) end def to_der content = @components.pack("w*") der_header(content.bytesize) << content end private def inspect_inner "{ #{@components.join(" ")} }" end def cast_to(type) return type.new(@components) if type <= ASN1Kit::RelativeOID super end def ==(other) other.is_a?(ASN1Kit::RelativeOID) && @components == other.components end end module ASN1Kit::Internal::CompileRelativeOID refine ASN1Kit::RelativeOID.singleton_class do def _new_internal(arys) obj = allocate obj.instance_variable_set(:@_compile_arys, arys) obj end end refine ASN1Kit::RelativeOID do def _compile_fixup(state) arys = remove_instance_variable(:@_compile_arys) components = [] arys.each do |ary| case ary when ASN1Kit::Internal::UnresolvedValue rel_oid = ary.unwrap(state) components.concat(rel_oid.components) else components.concat(ary.map { |v| v.unwrap_as_number(state) }) end end @components = components end end end