Class: Conjur::Policy::YAML::Handler::MapEntry
- Defined in:
- lib/conjur/policy/yaml/handler.rb
Overview
Processes a map entry. At this point, the parent record and the map key are known.
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Attributes inherited from Base
Instance Method Summary collapse
-
#alias(anchor) ⇒ Object
Interpret the alias as the map value and populate in the parent.
-
#initialize(parent, anchor, record, key) ⇒ MapEntry
constructor
A new instance of MapEntry.
- #mapping(value) ⇒ Object
- #scalar(value, tag, quoted, anchor) ⇒ Object
- #sequence(value) ⇒ Object
-
#start_mapping(tag, anchor) ⇒ Object
Start a mapping as a map value.
-
#start_sequence(anchor) ⇒ Object
Start a sequence as a map value.
- #value(value) ⇒ Object
Methods inherited from Base
#end_mapping, #end_sequence, #handler, #pop_handler, #push_handler
Constructor Details
#initialize(parent, anchor, record, key) ⇒ MapEntry
Returns a new instance of MapEntry.
249 250 251 252 253 254 |
# File 'lib/conjur/policy/yaml/handler.rb', line 249 def initialize parent, anchor, record, key super parent, anchor @record = record @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
247 248 249 |
# File 'lib/conjur/policy/yaml/handler.rb', line 247 def key @key end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
247 248 249 |
# File 'lib/conjur/policy/yaml/handler.rb', line 247 def record @record end |
Instance Method Details
#alias(anchor) ⇒ Object
Interpret the alias as the map value and populate in the parent.
271 272 273 |
# File 'lib/conjur/policy/yaml/handler.rb', line 271 def alias anchor value handler.anchor(anchor) end |
#mapping(value) ⇒ Object
260 261 262 |
# File 'lib/conjur/policy/yaml/handler.rb', line 260 def mapping value value value end |
#scalar(value, tag, quoted, anchor) ⇒ Object
294 295 296 |
# 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) ⇒ Object
256 257 258 |
# File 'lib/conjur/policy/yaml/handler.rb', line 256 def sequence value value value end |
#start_mapping(tag, anchor) ⇒ Object
Start a mapping as a map value.
276 277 278 279 280 281 282 283 284 285 |
# 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) ⇒ Object
Start a sequence as a map value.
288 289 290 291 292 |
# 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) ⇒ Object
264 265 266 267 268 |
# 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 |