Sha256: 261e2c1fd55a03dc44125095009c52760da8a71b61f4d5580a9f0d01a6523c74

Contents?: true

Size: 1.26 KB

Versions: 15

Compression:

Stored size: 1.26 KB

Contents

module Aws
  module Xml
    class Parser
      class Stack

        def initialize(shape, result = nil)
          @shape = shape
          @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.shape)
          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, @shape, @result)
        end

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

      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
aws-sdk-core-2.0.48 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.47 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.46 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.45 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.44 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.43 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.42 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.41 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.40 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.39 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.38 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.37 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.36 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.35 lib/aws-sdk-core/xml/parser/stack.rb
aws-sdk-core-2.0.34 lib/aws-sdk-core/xml/parser/stack.rb