class Conjur::Policy::YAML::Handler::Mapping
Handles a mapping, each of which will be parsed into a structured record.
Attributes
type[R]
Public Class Methods
new(parent, anchor, type)
click to toggle source
Calls superclass method
Conjur::Policy::YAML::Handler::Base::new
# File lib/conjur/policy/yaml/handler.rb, line 203 def initialize parent, anchor, type super parent, anchor @record = type.new end
Public Instance Methods
alias(anchor)
click to toggle source
Begins a mapping with the anchor value as the key.
# File lib/conjur/policy/yaml/handler.rb, line 223 def alias anchor key = handler.anchor(anchor) MapEntry.new(self, nil, @record, key).tap do |h| h.push_handler end end
end_mapping()
click to toggle source
# File lib/conjur/policy/yaml/handler.rb, line 238 def end_mapping parent.mapping @record handler.anchor anchor, @record if anchor pop_handler end
map_entry(key, value)
click to toggle source
# File lib/conjur/policy/yaml/handler.rb, line 209 def map_entry key, value handler.log { "#{handler.indent}Setting map entry #{key} = #{value}" } if @record.respond_to?(:[]=) @record.send(:[]=, key, value) else begin @record.send("#{key}=", value) rescue NoMethodError raise "No such attribute '#{key}' on type #{@record.class.short_name}" end end end
scalar(value, tag, quoted, anchor)
click to toggle source
Begins a new map entry.
# File lib/conjur/policy/yaml/handler.rb, line 231 def scalar value, tag, quoted, anchor value = scalar_value(value, tag, quoted, type) MapEntry.new(self, anchor, @record, value).tap do |h| h.push_handler end end