class Conjur::Policy::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, anchor, record_type)
click to toggle source
Calls superclass method
Conjur::Policy::YAML::Handler::Base::new
# File lib/conjur/policy/yaml/handler.rb, line 134 def initialize parent, anchor, record_type super parent, anchor @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/policy/yaml/handler.rb, line 155 def alias anchor handler.log { "#{handler.indent}Adding alias *#{anchor} to sequence, whose value is #{handler.anchor(anchor)}" } @list.push handler.anchor(anchor) end
end_sequence()
click to toggle source
# File lib/conjur/policy/yaml/handler.rb, line 192 def end_sequence parent.sequence @list handler.anchor anchor, @list if anchor pop_handler end
mapping(value)
click to toggle source
Adds a mapping to the sequence.
# File lib/conjur/policy/yaml/handler.rb, line 142 def mapping value handler.log { "#{handler.indent}Adding mapping #{value} to sequence" } @list.push value end
scalar(value, tag, quoted, anchor)
click to toggle source
When the sequence contains a scalar, the value should be appended to the result.
# File lib/conjur/policy/yaml/handler.rb, line 184 def scalar value, tag, quoted, anchor scalar_value(value, tag, quoted, record_type).tap do |value| handler.log { "#{handler.indent}Adding scalar *#{value} to sequence" } @list.push value handler.anchor anchor, value if anchor end end
sequence(value)
click to toggle source
Adds a sequence to the sequence.
# File lib/conjur/policy/yaml/handler.rb, line 148 def sequence value handler.log { "#{handler.indent}Adding sequence #{value} to sequence" } @list.push value end
start_mapping(tag, anchor)
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/policy/yaml/handler.rb, line 166 def start_mapping tag, anchor if type = type_of(tag, record_type) Mapping.new(self, anchor, type).tap do |h| h.push_handler end else raise "No type given or inferred for sequence entry" end end
start_sequence(anchor)
click to toggle source
Process a sequence within a sequence.
# File lib/conjur/policy/yaml/handler.rb, line 177 def start_sequence anchor Sequence.new(self, anchor, record_type).tap do |h| h.push_handler end end