Class: Iceberg::Storage
- Inherits:
-
Object
- Object
- Iceberg::Storage
- Defined in:
- lib/ibg/storage.rb
Instance Method Summary collapse
- #create ⇒ Object
- #dir ⇒ Object
- #getobject(name) ⇒ Object
-
#initialize ⇒ Storage
constructor
A new instance of Storage.
Constructor Details
Instance Method Details
#create ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/ibg/storage.rb', line 34 def create if @bucketname s3 = AWS::S3.new @bucket = s3.buckets.create(@bucketname) else path = SETTING['local']['download'] FileUtils.mkdir_p(path) end end |
#dir ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/ibg/storage.rb', line 24 def dir if @bucketname s3 = AWS::S3.new s3.buckets else path = SETTING['local']['download'] File.directory?(path) ? Dir.new(SETTING['local']['download']) : [] end end |
#getobject(name) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/ibg/storage.rb', line 16 def getobject(name) if @bucketname @bucket.objects['iceberg/' + name] else FileObject.new(name) end end |