Sha256: 6bf9a28a0adaaea4f02d30f5e2b8f6b26bbb2c2afa128a5cb1a05a7c37c87d26
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require 'aws' require 'vos/drivers/s3_vfs_storage' module Vos module Drivers class S3 attr_accessor :box attr_reader :connection, :bucket def initialize options = {} options = options.clone @bucket_name = options.delete(:bucket) || raise("S3 bucket not provided!") @acl = options.delete(:acl) || :public_read @options = options end # # Establishing SSH channel # def open &block if block if connection block.call self else begin open block.call self ensure close end end else unless connection @connection = ::AWS::S3.new self.options.clone @bucket = @connection.buckets[bucket_name] end end end def close; end # # Vfs # include S3VfsStorage # # Miscellaneous # def inspect; "<#{self.class.name} #{options.merge(bucket: bucket_name).inspect}>" end alias_method :to_s, :inspect def _clear bucket.objects.each{|o| o.delete} end protected attr_reader :options, :bucket_name, :acl end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vos-0.4.0 | lib/vos/drivers/s3.rb |