class Conjur::Policy::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, anchor, record, key) click to toggle source
# File lib/conjur/policy/yaml/handler.rb, line 249
def initialize parent, anchor, record, key
  super parent, anchor
  
  @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/policy/yaml/handler.rb, line 271
def alias anchor
  value handler.anchor(anchor)
end
mapping(value) click to toggle source
# File lib/conjur/policy/yaml/handler.rb, line 260
def mapping value
  value value
end
scalar(value, tag, quoted, anchor) click to toggle source
# File lib/conjur/policy/yaml/handler.rb, line 294
def scalar value, tag, quoted, anchor
  value scalar_value(value, tag, quoted, yaml_field_type(key))
end
sequence(value) click to toggle source
# File lib/conjur/policy/yaml/handler.rb, line 256
def sequence value
  value value
end
start_mapping(tag, anchor) click to toggle source

Start a mapping as a map value.

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

Start a sequence as a map value.

# File lib/conjur/policy/yaml/handler.rb, line 288
def start_sequence anchor
  Sequence.new(self, anchor, yaml_field_type(key)).tap do |h|
    h.push_handler
  end
end
value(value) click to toggle source
# File lib/conjur/policy/yaml/handler.rb, line 264
def value value
  parent.map_entry @key, value
  handler.anchor anchor, value if anchor
  pop_handler
end

Protected Instance Methods

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