class Aws::Xml::Parser::StructureFrame

Public Class Methods

new(xml_name, parent, ref, result = nil) click to toggle source
Calls superclass method Aws::Xml::Parser::Frame::new
# File lib/aws-sdk-core/xml/parser/frame.rb, line 80
def initialize(xml_name, 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

Public Instance Methods

child_frame(xml_name) click to toggle source
# File 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) click to toggle source
# File 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

Private Instance Methods

apply_default_value(name, ref) click to toggle source
# File lib/aws-sdk-core/xml/parser/frame.rb, line 115
def apply_default_value(name, ref)
  case ref.shape
  when ListShape then @result[name] = DefaultList.new
  when MapShape then @result[name] = DefaultMap.new
  end
end
flattened_list?(shape) click to toggle source
# File lib/aws-sdk-core/xml/parser/frame.rb, line 130
def flattened_list?(shape)
  ListShape === shape && shape['flattened']
end
xml_name(ref) click to toggle source
# File lib/aws-sdk-core/xml/parser/frame.rb, line 122
def xml_name(ref)
  if flattened_list?(ref.shape)
    ref.shape.member.location_name || ref.location_name
  else
    ref.location_name
  end
end