Class: UberS3::Bucket
- Inherits:
-
Object
- Object
- UberS3::Bucket
- Defined in:
- lib/uber-s3/bucket.rb
Defined Under Namespace
Classes: ObjectList
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#s3 ⇒ Object
Returns the value of attribute s3.
Instance Method Summary collapse
- #connection ⇒ Object
- #exists?(key) ⇒ Boolean
- #get(key) ⇒ Object
- #head(key) ⇒ Object
-
#initialize(s3, name) ⇒ Bucket
constructor
A new instance of Bucket.
- #object(key) ⇒ Object (also: #[])
- #objects(key, options = {}) ⇒ Object
- #store(key, value, options = {}) ⇒ Object (also: #set)
- #to_s ⇒ Object
Constructor Details
#initialize(s3, name) ⇒ Bucket
Returns a new instance of Bucket.
5 6 7 8 |
# File 'lib/uber-s3/bucket.rb', line 5 def initialize(s3, name) self.s3 = s3 self.name = name end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/uber-s3/bucket.rb', line 3 def name @name end |
#s3 ⇒ Object
Returns the value of attribute s3.
3 4 5 |
# File 'lib/uber-s3/bucket.rb', line 3 def s3 @s3 end |
Instance Method Details
#connection ⇒ Object
14 15 16 |
# File 'lib/uber-s3/bucket.rb', line 14 def connection s3.connection end |
#exists?(key) ⇒ Boolean
36 37 38 |
# File 'lib/uber-s3/bucket.rb', line 36 def exists?(key) object(key).exists? end |
#get(key) ⇒ Object
28 29 30 |
# File 'lib/uber-s3/bucket.rb', line 28 def get(key) object(key).fetch end |
#head(key) ⇒ Object
32 33 34 |
# File 'lib/uber-s3/bucket.rb', line 32 def head(key) object(key).head end |
#object(key) ⇒ Object Also known as: []
23 24 25 |
# File 'lib/uber-s3/bucket.rb', line 23 def object(key) Object.new(self, key) end |
#objects(key, options = {}) ⇒ Object
40 41 42 |
# File 'lib/uber-s3/bucket.rb', line 40 def objects(key, ={}) ObjectList.new(self, key, ) end |
#store(key, value, options = {}) ⇒ Object Also known as: set
18 19 20 |
# File 'lib/uber-s3/bucket.rb', line 18 def store(key, value, ={}) Object.new(self, key, value, ).save end |
#to_s ⇒ Object
10 11 12 |
# File 'lib/uber-s3/bucket.rb', line 10 def to_s name.to_s end |