Class: GyomuRuby::AmazonWebService::FileBucket::RichMan
- Inherits:
-
Object
- Object
- GyomuRuby::AmazonWebService::FileBucket::RichMan
- Defined in:
- lib/gyomu_ruby/amazon_web_service/file_bucket.rb
Instance Attribute Summary collapse
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
Instance Method Summary collapse
- #delete(key) ⇒ Object
- #get(key) ⇒ Object
-
#initialize(bucket) ⇒ RichMan
constructor
A new instance of RichMan.
- #put(key, io) ⇒ Object
Constructor Details
#initialize(bucket) ⇒ RichMan
Returns a new instance of RichMan.
51 52 53 54 55 56 |
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 51 def initialize(bucket) @bucket = bucket ::AWS::S3::Bucket.find(@bucket) rescue ::AWS::S3::NoSuchBucket ::AWS::S3::Bucket.create(@bucket) end |
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
49 50 51 |
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 49 def bucket @bucket end |
Instance Method Details
#delete(key) ⇒ Object
66 67 68 |
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 66 def delete(key) ::AWS::S3::S3Object.delete(key, @bucket) rescue false end |
#get(key) ⇒ Object
62 63 64 |
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 62 def get(key) ::AWS::S3::S3Object.value(key, @bucket) rescue nil end |
#put(key, io) ⇒ Object
58 59 60 |
# File 'lib/gyomu_ruby/amazon_web_service/file_bucket.rb', line 58 def put(key, io) ::AWS::S3::S3Object.store(key, io, @bucket) end |