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.
11 12 13 14 15 |
# File 'lib/file_locator.rb', line 11 def initialize(uri) uri = Addressable::URI.parse(uri) @bucket = Addressable::URI.unencode(uri.host) @key = Addressable::URI.unencode(ActiveEncode.sanitize_uri(uri)).sub(%r{^/*(.+)/*$}, '\1') end |
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
9 10 11 |
# File 'lib/file_locator.rb', line 9 def bucket @bucket end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9 10 11 |
# File 'lib/file_locator.rb', line 9 def key @key end |
Instance Method Details
#object ⇒ Object
17 18 19 |
# File 'lib/file_locator.rb', line 17 def object @object ||= Aws::S3::Object.new(bucket_name: bucket, key: key) end |