Class: S3Streamer::Streamer
- Inherits:
-
Object
- Object
- S3Streamer::Streamer
- Defined in:
- lib/s3streamer/streamer.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
Returns the value of attribute object.
Instance Method Summary collapse
-
#each ⇒ Object
Method to be called by Rack to stream our stored object.
-
#initialize(key, bucket = nil) ⇒ Streamer
constructor
Creates a Stremer object by fetching object the to be stremed and storing it for further processing.
Constructor Details
#initialize(key, bucket = nil) ⇒ Streamer
Creates a Stremer object by fetching object the to be stremed and storing it for further processing
11 12 13 14 15 16 |
# File 'lib/s3streamer/streamer.rb', line 11 def initialize key, bucket = nil # Use default bucket if not set bucket ||= S3Streamer.bucket # Fetch object to be streamed @object = AWS::S3::Bucket.new(bucket).objects[key] end |
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
3 4 5 |
# File 'lib/s3streamer/streamer.rb', line 3 def object @object end |
Instance Method Details
#each ⇒ Object
Method to be called by Rack to stream our stored object
20 21 22 23 24 |
# File 'lib/s3streamer/streamer.rb', line 20 def each @object.read do |segment| yield segment end end |