@private
# File lib/aws/core/xml_grammar.rb, line 33 def initialize @data = {} end
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
# File lib/aws/core/xml_grammar.rb, line 37 def id @data[:id] end
# File lib/aws/core/xml_grammar.rb, line 72 def inspect methods = @data.keys "<Object #{methods.reject{|m| m =~ /=$/ }.join(', ')}>" end
# 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
# File lib/aws/core/xml_grammar.rb, line 48 def respond_to?(m) @data.key?(m.to_sym) or super end
# 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