class Sluice::Storage::S3::Location

Class to describe an S3 location TODO: if we are going to require trailing line-breaks on buckets, maybe we should make that clearer?

Attributes

bucket[R]
dir[R]

Public Class Methods

new(s3_location) click to toggle source
# File lib/sluice/storage/s3/location.rb, line 36
def initialize(s3_location)
  @s3_location = s3_location

  s3_location_match = s3_location.match('^s3n?://([^/]+)/?(.*)/$')
  raise ArgumentError, 'Bad S3 location %s' % s3_location unless s3_location_match

  @bucket = s3_location_match[1]
  @dir = s3_location_match[2]
  self
end

Public Instance Methods

==(o) click to toggle source
# File lib/sluice/storage/s3/location.rb, line 62
def ==(o)
  o.class == self.class && o.state == state
end
Also aliased as: eql?
dir_as_path() click to toggle source
# File lib/sluice/storage/s3/location.rb, line 48
def dir_as_path
  if @dir.length > 0
    return @dir+'/'
  else
    return ''
  end
end
eql?(o)
Alias for: ==
to_s() click to toggle source
# File lib/sluice/storage/s3/location.rb, line 57
def to_s
  @s3_location
end

Protected Instance Methods

state() click to toggle source
# File lib/sluice/storage/s3/location.rb, line 70
def state
  [@s3_location, @bucket, @dir]
end