class Conjur::DSL2::YAML::Handler::Sequence
Handles a sequence. The sequence has: record_type
default record type, inferred from the field name on the parent record. args
the start_sequence
arguments.
Attributes
record_type[R]
Public Class Methods
new(parent, record_type)
click to toggle source
Calls superclass method
Conjur::DSL2::YAML::Handler::Base::new
# File lib/conjur/dsl2/yaml/handler.rb, line 140 def initialize parent, record_type super parent @record_type = record_type @list = [] end
Public Instance Methods
alias(anchor)
click to toggle source
When the sequence receives an alias, the alias should be mapped to the previously stored value and added to the result list.
# File lib/conjur/dsl2/yaml/handler.rb, line 161 def alias anchor @list.push handler.anchor(anchor) end
end_sequence()
click to toggle source
# File lib/conjur/dsl2/yaml/handler.rb, line 195 def end_sequence parent.sequence @list pop_handler end
mapping(value)
click to toggle source
Adds a mapping to the sequence.
# File lib/conjur/dsl2/yaml/handler.rb, line 150 def mapping value @list.push value end
result()
click to toggle source
# File lib/conjur/dsl2/yaml/handler.rb, line 147 def result; @list; end
scalar(value, tag, quoted)
click to toggle source
When the sequence contains a scalar, the value should be appended to the result.
# File lib/conjur/dsl2/yaml/handler.rb, line 189 def scalar value, tag, quoted scalar_value(value, tag, quoted, record_type).tap do |value| @list.push value end end
sequence(value)
click to toggle source
Adds a sequence to the sequence.
# File lib/conjur/dsl2/yaml/handler.rb, line 155 def sequence value @list.push value end
start_mapping(tag)
click to toggle source
When the sequence contains a mapping, a new record should be created corresponding to either:
-
The explicit stated type (tag) of the mapping
-
The implicit field type of the sequence
If neither of these is available, it’s an error.
# File lib/conjur/dsl2/yaml/handler.rb, line 171 def start_mapping tag if type = type_of(tag, record_type) Mapping.new(self, type).tap do |h| h.push_handler end.result else raise "No type given or inferred for sequence entry" end end
start_sequence()
click to toggle source
Process a sequence within a sequence.
# File lib/conjur/dsl2/yaml/handler.rb, line 182 def start_sequence Sequence.new(self, record_type).tap do |h| h.push_handler end.result end