Class: UberS3::Bucket

Inherits:
Object
  • Object
show all
Defined in:
lib/uber-s3/bucket.rb

Defined Under Namespace

Classes: ObjectList

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/uber-s3/bucket.rb', line 3

def name
  @name
end

#s3Object

Returns the value of attribute s3.



3
4
5
# File 'lib/uber-s3/bucket.rb', line 3

def s3
  @s3
end

Instance Method Details

#connectionObject



14
15
16
# File 'lib/uber-s3/bucket.rb', line 14

def connection
  s3.connection
end

#exists?(key) ⇒ Boolean

Returns:

  • (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, options={})
  ObjectList.new(self, key, options)
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, options={})
  Object.new(self, key, value, options).save
end

#to_sObject



10
11
12
# File 'lib/uber-s3/bucket.rb', line 10

def to_s
  name.to_s
end