You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Xml::Parser::Stack

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/stack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ref, result = nil, &unhandled_callback) ⇒ Stack

Returns a new instance of Stack



6
7
8
9
10
11
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/stack.rb', line 6

def initialize(ref, result = nil, &unhandled_callback)
  @ref = ref
  @frame = self
  @result = result
  @unhandled_callback = unhandled_callback
end

Instance Attribute Details

#frameObject (readonly)

Returns the value of attribute frame



13
14
15
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/stack.rb', line 13

def frame
  @frame
end

#resultObject (readonly)

Returns the value of attribute result



15
16
17
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/stack.rb', line 15

def result
  @result
end

Instance Method Details

#attr(name, value) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/stack.rb', line 21

def attr(name, value)
  if name.to_s == 'encoding' && value.to_s == 'base64'
    @frame = BlobFrame.new(name, @frame.parent, @frame.ref)
  else
    start_element(name)
    text(value)
    end_element(name)
  end
end

#child_frame(name) ⇒ Object



48
49
50
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/stack.rb', line 48

def child_frame(name)
  Frame.new(name, self, @ref, @result)
end

#consume_child_frame(frame) ⇒ Object



52
53
54
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/stack.rb', line 52

def consume_child_frame(frame)
  @result = frame.result
end

#end_element(*args) ⇒ Object



35
36
37
38
39
40
41
42
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/stack.rb', line 35

def end_element(*args)
  @frame.parent.consume_child_frame(@frame)
  if @frame.parent.is_a?(FlatListFrame)
    @frame = @frame.parent
    @frame.parent.consume_child_frame(@frame)
  end
  @frame = @frame.parent
end

#error(msg, line = nil, column = nil) ⇒ Object

Raises:



44
45
46
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/stack.rb', line 44

def error(msg, line = nil, column = nil)
  raise ParsingError.new(msg, line, column)
end

#start_element(name) ⇒ Object



17
18
19
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/stack.rb', line 17

def start_element(name)
  @frame = @frame.child_frame(name.to_s)
end

#text(value) ⇒ Object



31
32
33
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/stack.rb', line 31

def text(value)
  @frame.set_text(value)
end