Class: GyomuRuby::AmazonWebService::FileBucket
- Inherits:
-
Object
- Object
- GyomuRuby::AmazonWebService::FileBucket
- Extended by:
- Forwardable
- Defined in:
- lib/gyomu_ruby/amazon_web_service/file_bucket.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#backend ⇒ Object
Returns the value of attribute backend.
Instance Method Summary collapse
-
#initialize(bucket = 'bucket') ⇒ FileBucket
constructor
A new instance of FileBucket.
- #put(io) ⇒ Object
Constructor Details
#initialize(bucket = 'bucket') ⇒ FileBucket
Returns a new instance of FileBucket.
12 13 14 |
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 12 def initialize(bucket = 'bucket') @backend = Rails.env.production? || Rails.env.staging? ? RichMan.new(bucket) : PoorMan.new(bucket) end |
Instance Attribute Details
#backend ⇒ Object
Returns the value of attribute backend.
7 8 9 |
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 7 def backend @backend end |
Instance Method Details
#put(io) ⇒ Object
16 17 18 19 20 |
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 16 def put(io) "#{Time.now.strftime('%Y%m%d%H%M')}_#{SecureRandom.hex(5)}".tap do |key| @backend.put(key, io) end end |