Class: FakeAWS::S3::S3Object
- Inherits:
-
Object
- Object
- FakeAWS::S3::S3Object
- Defined in:
- lib/fake_aws/s3/s3_object.rb
Instance Attribute Summary collapse
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #content_length ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(bucket, key) ⇒ S3Object
constructor
A new instance of S3Object.
- #read ⇒ Object
- #write(data) ⇒ Object
Constructor Details
#initialize(bucket, key) ⇒ S3Object
Returns a new instance of S3Object.
6 7 8 9 |
# File 'lib/fake_aws/s3/s3_object.rb', line 6 def initialize(bucket, key) @bucket = bucket @key = key end |
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
11 12 13 |
# File 'lib/fake_aws/s3/s3_object.rb', line 11 def bucket @bucket end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
12 13 14 |
# File 'lib/fake_aws/s3/s3_object.rb', line 12 def key @key end |
Instance Method Details
#content_length ⇒ Object
24 25 26 27 |
# File 'lib/fake_aws/s3/s3_object.rb', line 24 def content_length must_exist! @data.length end |
#exists? ⇒ Boolean
29 30 31 |
# File 'lib/fake_aws/s3/s3_object.rb', line 29 def exists? !!@data end |
#read ⇒ Object
19 20 21 22 |
# File 'lib/fake_aws/s3/s3_object.rb', line 19 def read must_exist! @data end |
#write(data) ⇒ Object
14 15 16 17 |
# File 'lib/fake_aws/s3/s3_object.rb', line 14 def write(data) data = data.read if data.respond_to?(:read) @data = data end |