Class: DerParse::Node::Sequence

Inherits:
DerParse::Node show all
Defined in:
lib/derparse/node/sequence.rb

Instance Attribute Summary

Attributes inherited from DerParse::Node

#data, #data_length, #depth, #length_length, #offset, #rest, #tag, #tag_class, #tag_length

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DerParse::Node

#complete?, #constructed?, #der_length, factory, #header_length, #initialize, #next_node, #primitive?

Constructor Details

This class inherits a constructor from DerParse::Node

Class Method Details

.handles?(der) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/derparse/node/sequence.rb', line 4

def self.handles?(der)
  der[0] == "\x30"
end

Instance Method Details

#first_childObject



20
21
22
23
24
25
26
# File 'lib/derparse/node/sequence.rb', line 20

def first_child
  if @data.empty?
    DerParse::Node::Nil.new
  else
    DerParse::Node.factory(@data)
  end
end

#valueObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/derparse/node/sequence.rb', line 8

def value
  [].tap do |v|
    r = @data

    until r == ""
      n = DerParse::Node.factory(r)
      v << n.value
      r = n.rest
    end
  end
end