Class: FileLocator::S3File
- Inherits:
-
Object
- Object
- FileLocator::S3File
- Defined in:
- lib/file_locator.rb
Instance Attribute Summary collapse
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#initialize(uri) ⇒ S3File
constructor
A new instance of S3File.
- #object ⇒ Object
Constructor Details
#initialize(uri) ⇒ S3File
Returns a new instance of S3File.
10 11 12 13 14 |
# File 'lib/file_locator.rb', line 10 def initialize(uri) uri = Addressable::URI.parse(uri) @bucket = URI.decode(uri.host) @key = URI.decode(uri.path).sub(%r(^/*(.+)/*$),'\1') end |
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
8 9 10 |
# File 'lib/file_locator.rb', line 8 def bucket @bucket end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/file_locator.rb', line 8 def key @key end |
Instance Method Details
#object ⇒ Object
16 17 18 |
# File 'lib/file_locator.rb', line 16 def object @object ||= Aws::S3::Object.new(bucket_name: bucket, key: key) end |