class OmniStore::Storage::S3::Mountpoint
Attributes
bucket[R]
Public Class Methods
new(name, bucket)
click to toggle source
# File lib/omnistore/storage/s3/mountpoint.rb, line 7 def initialize(name, bucket) @name = name @bucket = bucket end
Public Instance Methods
copy(src, dest, other = self, options = {})
click to toggle source
# File lib/omnistore/storage/s3/mountpoint.rb, line 51 def copy(src, dest, other = self, options = {}) options[:bucket] = other.bucket bucket.objects[src].copy_to(dest, options) end
delete(key, options = {})
click to toggle source
# File lib/omnistore/storage/s3/mountpoint.rb, line 28 def delete(key, options = {}) bucket.objects[key].delete(options) end
delete_if(key_prefix = nil) { |key| ... }
click to toggle source
# File lib/omnistore/storage/s3/mountpoint.rb, line 32 def delete_if(key_prefix = nil, &block) bucket.objects.with_prefix(key_prefix).delete_if do |object| yield object.key end end
exist?(key)
click to toggle source
# File lib/omnistore/storage/s3/mountpoint.rb, line 24 def exist?(key) bucket.objects[key].exists? end
move(src, dest, other = self, options = {})
click to toggle source
# File lib/omnistore/storage/s3/mountpoint.rb, line 46 def move(src, dest, other = self, options = {}) options[:bucket_name] = other.bucket.name bucket.objects[src].move_to(dest, options) end
name()
click to toggle source
# File lib/omnistore/storage/s3/mountpoint.rb, line 12 def name @name end
read(key, options = {}, &block)
click to toggle source
# File lib/omnistore/storage/s3/mountpoint.rb, line 38 def read(key, options = {}, &block) bucket.objects[key].read(options, &block) end
url(key = nil, options = {})
click to toggle source
# File lib/omnistore/storage/s3/mountpoint.rb, line 16 def url(key = nil, options = {}) if key bucket.objects[key].public_url(:secure => options[:secure] != false).to_s else bucket.url end end
write(key, options_or_data = nil, options = {})
click to toggle source
# File lib/omnistore/storage/s3/mountpoint.rb, line 42 def write(key, options_or_data = nil, options = {}) bucket.objects[key].write(options_or_data, options) end