Class: S3Toolkit::UrlParser
- Inherits:
-
Object
- Object
- S3Toolkit::UrlParser
- Defined in:
- lib/s3-toolkit/url_parser.rb
Class Method Summary collapse
Class Method Details
.call(s3_url) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/s3-toolkit/url_parser.rb', line 5 def self.call(s3_url) raise URI::InvalidURIError, "Unexpected format, expected: s3://<bucket>/<key>" unless s3_url&.start_with?("s3://") uri = URI.parse(s3_url) bucket = uri.host key = uri.path[1..] # Strip the leading / [bucket, key] end |