Method: Awsum::Ec2::ImageParser#tag_end

Defined in:
lib/ec2/image.rb

#tag_end(tag) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/ec2/image.rb', line 89

def tag_end(tag)
  case tag
    when 'DescribeImagesResponse', 'requestId'
      #no-op
    when 'imagesSet', 'productCodes'
      @stack.pop
    when 'item'
      case @stack[-1]
        when 'imagesSet'
          @images << Image.new(
                        @ec2,
                        @current['imageId'], 
                        @current['imageLocation'], 
                        @current['imageState'], 
                        @current['imageOwnerId'], 
                        @current['isPublic'] == 'true', 
                        @current['architecture'], 
                        @current['imageType'],
                        @current['kernelId'],
                        @current['ramdiskId'],
                        @current['platform'],
                        @product_codes || []
                      )
          @text = ''
      end
    when 'productCode'
      @product_codes << @text.strip
    else
      unless @text.nil?
        text = @text.strip
        @current[tag] = (text == '' ? nil : text)
        @text = ''
      end
  end
end