Sha256: 820bfe486ae34a7607b3a917a0dc3dd199f7649026f80d3e7270848c7ef1b563
Contents?: true
Size: 928 Bytes
Versions: 5
Compression:
Stored size: 928 Bytes
Contents
module Awsum class S3 class BucketParser < Awsum::Parser #:nodoc: def initialize(s3) @s3 = s3 @buckets = [] @text = nil end def tag_start(tag, attributes) case tag when 'Bucket' @current = {} @text = '' end end def text(text) @text << text unless @text.nil? end def tag_end(tag) case tag when 'Bucket' @buckets << Bucket.new( @s3, @current['Name'], Time.parse(@current['CreationDate']) ) @text = nil @current = nil else text = @text.strip unless @text.nil? @current[tag] = (text == '' ? nil : text) unless @current.nil? end end def result @buckets end end end end
Version data entries
5 entries across 5 versions & 1 rubygems