class Conjur::DSL2::YAML::Handler::MapEntry

Processes a map entry. At this point, the parent record and the map key are known.

Attributes

key[R]
record[R]

Public Class Methods

new(parent, record, key) click to toggle source
Calls superclass method Conjur::DSL2::YAML::Handler::Base::new
# File lib/conjur/dsl2/yaml/handler.rb, line 251
def initialize parent, record, key
  super parent
  
  @record = record
  @key = key
end

Public Instance Methods

alias(anchor) click to toggle source

Interpret the alias as the map value and populate in the parent.

# File lib/conjur/dsl2/yaml/handler.rb, line 274
def alias anchor
  value handler.anchor(anchor)
end
mapping(value) click to toggle source
# File lib/conjur/dsl2/yaml/handler.rb, line 264
def mapping value
  value value
end
result() click to toggle source
# File lib/conjur/dsl2/yaml/handler.rb, line 258
def result; nil; end
scalar(value, tag, quoted) click to toggle source
# File lib/conjur/dsl2/yaml/handler.rb, line 297
def scalar value, tag, quoted
  value scalar_value(value, tag, quoted, yaml_field_type(key))
end
sequence(value) click to toggle source
# File lib/conjur/dsl2/yaml/handler.rb, line 260
def sequence value
  value value
end
start_mapping(tag) click to toggle source

Start a mapping as a map value.

# File lib/conjur/dsl2/yaml/handler.rb, line 279
def start_mapping tag
  if type = type_of(tag, yaml_field_type(key))
    Mapping.new(self, type).tap do |h|
      h.push_handler
    end.result
  else
    # We got a mapping on a simple type
    raise "Attribute '#{key}' can't be a mapping"
  end
end
start_sequence() click to toggle source

Start a sequence as a map value.

# File lib/conjur/dsl2/yaml/handler.rb, line 291
def start_sequence
  Sequence.new(self, yaml_field_type(key)).tap do |h|
    h.push_handler
  end.result
end
value(value) click to toggle source
# File lib/conjur/dsl2/yaml/handler.rb, line 268
def value value
  parent.map_entry @key, value
  pop_handler
end

Protected Instance Methods

yaml_field_type(key) click to toggle source
# File lib/conjur/dsl2/yaml/handler.rb, line 303
def yaml_field_type key
  record.class.respond_to?(:yaml_field_type) ? record.class.yaml_field_type(key) : nil
end