Class: Awsum::S3::BucketParser
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(s3) ⇒ BucketParser
constructor
A new instance of BucketParser.
- #result ⇒ Object
- #tag_end(tag) ⇒ Object
- #tag_start(tag, attributes) ⇒ Object
- #text(text) ⇒ Object
Methods inherited from Parser
Constructor Details
#initialize(s3) ⇒ BucketParser
Returns a new instance of BucketParser.
27 28 29 30 31 |
# File 'lib/s3/bucket.rb', line 27 def initialize(s3) @s3 = s3 @buckets = [] @text = nil end |
Instance Method Details
#result ⇒ Object
61 62 63 |
# File 'lib/s3/bucket.rb', line 61 def result @buckets end |
#tag_end(tag) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/s3/bucket.rb', line 45 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 |
#tag_start(tag, attributes) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/s3/bucket.rb', line 33 def tag_start(tag, attributes) case tag when 'Bucket' @current = {} @text = '' end end |
#text(text) ⇒ Object
41 42 43 |
# File 'lib/s3/bucket.rb', line 41 def text(text) @text << text unless @text.nil? end |