Class: Conjur::Policy::YAML::Handler::Base
- Defined in:
- lib/conjur/policy/yaml/handler.rb
Overview
An abstract Base handler. The handler will receive each document message within its particular context (sequence, mapping, etc).
The handler can decide that the message is not allowed by not implementing the message.
Instance Attribute Summary collapse
-
#anchor ⇒ Object
readonly
Returns the value of attribute anchor.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
-
#alias(anchor) ⇒ Object
An alias is encountered in the document.
-
#end_mapping ⇒ Object
End the current mapping.
-
#end_sequence ⇒ Object
End the current sequence.
-
#handler ⇒ Object
Handlers are organized in a stack.
-
#initialize(parent, anchor) ⇒ Base
constructor
A new instance of Base.
-
#pop_handler ⇒ Object
Pop this handler off the stack, indicating that it’s complete.
-
#push_handler ⇒ Object
Push this handler onto the stack.
-
#scalar(value, tag, quoted, anchor) ⇒ Object
Process a scalar value.
-
#start_mapping(tag, anchor) ⇒ Object
Start a new mapping with the specified tag.
-
#start_sequence(anchor) ⇒ Object
Start a new sequence.
Constructor Details
#initialize(parent, anchor) ⇒ Base
Returns a new instance of Base.
17 18 19 20 |
# File 'lib/conjur/policy/yaml/handler.rb', line 17 def initialize parent, anchor @parent = parent @anchor = anchor end |
Instance Attribute Details
#anchor ⇒ Object (readonly)
Returns the value of attribute anchor.
15 16 17 |
# File 'lib/conjur/policy/yaml/handler.rb', line 15 def anchor @anchor end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
15 16 17 |
# File 'lib/conjur/policy/yaml/handler.rb', line 15 def parent @parent end |
Instance Method Details
#alias(anchor) ⇒ Object
An alias is encountered in the document. The value may be looked up in the root Handler anchor
hash.
38 39 40 |
# File 'lib/conjur/policy/yaml/handler.rb', line 38 def alias anchor raise "Unexpected alias #{anchor}" end |
#end_mapping ⇒ Object
End the current mapping. The handler should populate the mapping into the parent handler.
60 61 62 |
# File 'lib/conjur/policy/yaml/handler.rb', line 60 def end_mapping raise "Unexpected end of mapping" end |
#end_sequence ⇒ Object
End the current sequence. The handler should populate the sequence into the parent handler.
55 56 57 |
# File 'lib/conjur/policy/yaml/handler.rb', line 55 def end_sequence raise "Unexpected end of sequence" end |
#handler ⇒ Object
Handlers are organized in a stack. Each handler can find the root Handler by traversing up the stack.
23 24 25 |
# File 'lib/conjur/policy/yaml/handler.rb', line 23 def handler parent.handler end |
#pop_handler ⇒ Object
Pop this handler off the stack, indicating that it’s complete.
33 34 35 |
# File 'lib/conjur/policy/yaml/handler.rb', line 33 def pop_handler handler.pop_handler end |
#push_handler ⇒ Object
Push this handler onto the stack.
28 29 30 |
# File 'lib/conjur/policy/yaml/handler.rb', line 28 def push_handler handler.push_handler self end |
#scalar(value, tag, quoted, anchor) ⇒ Object
Process a scalar value. It may be a map key, a map value, or a sequence value.
65 66 67 |
# File 'lib/conjur/policy/yaml/handler.rb', line 65 def scalar value, tag, quoted, anchor raise "Unexpected scalar" end |
#start_mapping(tag, anchor) ⇒ Object
Start a new mapping with the specified tag. If the handler wants to accept the message, it should return a new handler.
44 45 46 |
# File 'lib/conjur/policy/yaml/handler.rb', line 44 def start_mapping tag, anchor raise "Unexpected mapping" end |
#start_sequence(anchor) ⇒ Object
Start a new sequence. If the handler wants to accept the message, it should return a new handler.
50 51 52 |
# File 'lib/conjur/policy/yaml/handler.rb', line 50 def start_sequence anchor raise "Unexpected sequence" end |