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

#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.



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

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

Instance Attribute Details

#handlerObject (readonly)

Returns the value of attribute handler.



103
104
105
# File 'lib/conjur/policy/yaml/handler.rb', line 103

def handler
  @handler
end

#resultObject (readonly)

Returns the value of attribute result.



103
104
105
# File 'lib/conjur/policy/yaml/handler.rb', line 103

def result
  @result
end

Instance Method Details

#end_sequenceObject

Finish the sequence, and the document.



129
130
131
# File 'lib/conjur/policy/yaml/handler.rb', line 129

def end_sequence
  pop_handler
end

#sequence(seq) ⇒ Object



114
115
116
117
# File 'lib/conjur/policy/yaml/handler.rb', line 114

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

#start_sequenceObject

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.



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

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