class S3Utils::Path
Public Class Methods
new(path)
click to toggle source
# File lib/s3_utils/path.rb, line 5 def initialize(path) @path = Pathname.new(path) end
Public Instance Methods
bucket_name()
click to toggle source
# File lib/s3_utils/path.rb, line 9 def bucket_name return '' if @path.to_s.empty? || @path.to_s == '.' element[0].to_s.empty? ? element[1] : element[0] end
element()
click to toggle source
# File lib/s3_utils/path.rb, line 20 def element @element ||= @path.cleanpath.to_s.split(Pathname::SEPARATOR_PAT) end
path_without_bucket()
click to toggle source
# File lib/s3_utils/path.rb, line 15 def path_without_bucket ele = element.drop_while(&:empty?).drop(1) File.join(ele) end