You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Xml::Parser::StructureFrame

Inherits:
Frame
  • Object
show all
Defined in:
gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/frame.rb

Instance Attribute Summary

Attributes inherited from Frame

#parent, #ref, #result

Instance Method Summary collapse

Methods inherited from Frame

new, #set_text

Constructor Details

#initialize(xml_name, parent, ref, result = nil) ⇒ StructureFrame

Returns a new instance of StructureFrame



80
81
82
83
84
85
86
87
88
89
90
91
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/frame.rb', line 80

def initialize(xml_name, parent, ref, result = nil)
  super
  @result ||= ref.shape.struct_class.new
  @members = {}
  ref.shape.members.each do |member_name, member_ref|
    apply_default_value(member_name, member_ref)
    @members[xml_name(member_ref)] = {
      name: member_name,
      ref: member_ref,
    }
  end
end

Instance Method Details

#child_frame(xml_name) ⇒ Object



93
94
95
96
97
98
99
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/frame.rb', line 93

def child_frame(xml_name)
  if @member = @members[xml_name]
    Frame.new(xml_name, self, @member[:ref])
  else
    NullFrame.new(xml_name, self)
  end
end

#consume_child_frame(child) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/frame.rb', line 101

def consume_child_frame(child)
  case child
  when MapEntryFrame
    @result[@member[:name]][child.key.result] = child.value.result
  when FlatListFrame
    @result[@member[:name]] << child.result
  when NullFrame
  else
    @result[@member[:name]] = child.result
  end
end