Sha256: 4e189dad3eade0b9131db242cbe889ce009bdfd10f39f4777b244110aadeb983

Contents?: true

Size: 1.51 KB

Versions: 1113

Compression:

Stored size: 1.51 KB

Contents

module Aws
  module Xml
    class Parser
      class Stack

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

        attr_reader :frame

        attr_reader :result

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

        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

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

        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

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

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

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

        # @api private
        def yield_unhandled_value(path, value)
          if @unhandled_callback
            @unhandled_callback.call(path, value)
          end
        end

      end
    end
  end
end

Version data entries

1,113 entries across 1,113 versions & 2 rubygems

Version Path
aws-sdk-core-2.11.632 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.631 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.630 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.629 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.628 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.627 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.626 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.625 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.624 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.623 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.622 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.621 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.620 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.619 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.618 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.617 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.616 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.615 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.614 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.11.613 lib/aws-sdk-core/xml/parser/stack.rb