class AWS::Core::XmlGrammar::Context

@private

Public Class Methods

new() click to toggle source
# File lib/aws/core/xml_grammar.rb, line 33
def initialize
  @data = {}
end

Public Instance Methods

__set_data__(getter, value) click to toggle source

this gets called a LOT during response parsing, and having it be a public method is the fastest way to call it. Strictly speaking it should be private. @private

# File lib/aws/core/xml_grammar.rb, line 81
def __set_data__(getter, value)
  @data[getter.to_sym] = value
end
id() click to toggle source
# File lib/aws/core/xml_grammar.rb, line 37
def id
  @data[:id]
end
inspect() click to toggle source
# File lib/aws/core/xml_grammar.rb, line 72
def inspect
  methods = @data.keys
  "<Object #{methods.reject{|m| m =~ /=$/ }.join(', ')}>" 
end
method_missing(m, *args) click to toggle source
# File lib/aws/core/xml_grammar.rb, line 41
def method_missing(m, *args)
  key = m.to_sym
  
  return super unless @data.key?(key)
  @data[key]
end
respond_to?(m) click to toggle source
# File lib/aws/core/xml_grammar.rb, line 48
def respond_to?(m)
  @data.key?(m.to_sym) or super
end
to_hash() click to toggle source
# File lib/aws/core/xml_grammar.rb, line 52
def to_hash
  @data.inject({}) do |hash,(key,value)|

    # strip question marks from hash keys
    if matches = key.to_s.match(%r(.+)\?$/)
      key = matches[1].to_sym
    end

    # recursively convert hashes
    if value.is_a?(Array)
      value = value.map{|v| v.is_a?(Context) ? v.to_hash : v }
    elsif value.is_a?(Context)
      value = value.to_hash
    end

    hash.merge(key => value)

  end
end