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

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary

Attributes inherited from Frame

#parent, #ref, #result

Instance Method Summary collapse

Methods inherited from Frame

new, #set_text

Constructor Details

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of StructureFrame.



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/aws-sdk-core/xml/parser/frame.rb', line 65

def initialize(parent, ref, result = nil)
  super
  @result ||= ref[: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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



78
79
80
81
82
83
84
# File 'lib/aws-sdk-core/xml/parser/frame.rb', line 78

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

#consume_child_frame(child) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/aws-sdk-core/xml/parser/frame.rb', line 86

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