Class: Conjur::Policy::YAML::Handler::Root

Inherits:
Base show all
Defined in:
lib/conjur/policy/yaml/handler.rb

Overview

Handles the root document, which should be a sequence.

Instance Attribute Summary collapse

Attributes inherited from Base

#anchor, #parent

Instance Method Summary collapse

Methods inherited from Base

#alias, #end_mapping, #pop_handler, #push_handler, #scalar, #start_mapping

Constructor Details

#initialize(handler) ⇒ Root

Returns a new instance of Root.



99
100
101
102
103
104
# File 'lib/conjur/policy/yaml/handler.rb', line 99

def initialize handler
  super nil, nil
  
  @handler = handler
  @result = nil
end

Instance Attribute Details

#handlerObject (readonly)

Returns the value of attribute handler.



97
98
99
# File 'lib/conjur/policy/yaml/handler.rb', line 97

def handler
  @handler
end

#resultObject (readonly)

Returns the value of attribute result.



97
98
99
# File 'lib/conjur/policy/yaml/handler.rb', line 97

def result
  @result
end

Instance Method Details

#end_sequenceObject

Finish the sequence, and the document.



123
124
125
# File 'lib/conjur/policy/yaml/handler.rb', line 123

def end_sequence
  pop_handler
end

#sequence(seq) ⇒ Object



108
109
110
111
# File 'lib/conjur/policy/yaml/handler.rb', line 108

def sequence seq
  raise "Already got sequence result" if @result
  @result = seq
end

#start_sequence(anchor) ⇒ Object

The document root is expected to start with a sequence. A Sequence handler is constructed with no implicit type. This sub-handler handles the message.



116
117
118
119
120
# File 'lib/conjur/policy/yaml/handler.rb', line 116

def start_sequence anchor
  Sequence.new(self, anchor, nil).tap do |h|
    h.push_handler
  end
end