class Conjur::DSL2::YAML::Handler::Mapping
Handles a mapping, each of which will be parsed into a structured record.
Attributes
type[R]
Public Class Methods
new(parent, type)
click to toggle source
Calls superclass method
Conjur::DSL2::YAML::Handler::Base::new
# File lib/conjur/dsl2/yaml/handler.rb, line 205 def initialize parent, type super parent @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/dsl2/yaml/handler.rb, line 226 def alias anchor key = handler.anchor(anchor) MapEntry.new(self, @record, key).tap do |h| h.push_handler end.result end
end_mapping()
click to toggle source
# File lib/conjur/dsl2/yaml/handler.rb, line 241 def end_mapping parent.mapping @record pop_handler end
map_entry(key, value)
click to toggle source
# File lib/conjur/dsl2/yaml/handler.rb, line 213 def 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
result()
click to toggle source
# File lib/conjur/dsl2/yaml/handler.rb, line 211 def result; @record; end
scalar(value, tag, quoted)
click to toggle source
Begins a new map entry.
# File lib/conjur/dsl2/yaml/handler.rb, line 234 def scalar value, tag, quoted value = scalar_value(value, tag, quoted, type) MapEntry.new(self, @record, value).tap do |h| h.push_handler end.result end