Sha256: 7dcab4408c5bb3e7ddc5e19355f16ad8b4b7303053e55259f3cfcae21e8186e1

Contents?: true

Size: 1.25 KB

Versions: 47

Compression:

Stored size: 1.25 KB

Contents

module Aws
  module Xml
    class Parser
      class Stack

        def initialize(ref, result = nil)
          @ref = ref
          @frame = self
          @result = result
        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(@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(self, @ref, @result)
        end

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

      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
aws-sdk-core-2.2.10 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.2.9 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.2.8 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.2.7 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.2.6 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.2.5 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.2.4 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.2.3 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.2.2 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.2.1 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.2.0 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.1.36 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.1.35 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.1.34 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.1.33 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.1.32 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.1.31 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.1.30 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.1.29 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.1.28 lib/aws-sdk-core/xml/parser/stack.rb