Class: S3Ranger::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/s3ranger/sync.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, bucket = nil) ⇒ Location

Returns a new instance of Location.

Raises:

  • (RuntimeError)


46
47
48
49
50
# File 'lib/s3ranger/sync.rb', line 46

def initialize path, bucket=nil
  raise RuntimeError if path.nil?
  @path = path
  @bucket = bucket || nil
end

Instance Attribute Details

#bucketObject

Returns the value of attribute bucket.



44
45
46
# File 'lib/s3ranger/sync.rb', line 44

def bucket
  @bucket
end

#pathObject

Returns the value of attribute path.



43
44
45
# File 'lib/s3ranger/sync.rb', line 43

def path
  @path
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



63
64
65
# File 'lib/s3ranger/sync.rb', line 63

def == other
  @path == other.path and @bucket == other.bucket
end

#local?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/s3ranger/sync.rb', line 59

def local?
  @bucket.nil?
end

#to_sObject



52
53
54
55
56
57
# File 'lib/s3ranger/sync.rb', line 52

def to_s
  out = []
  out << @bucket unless @bucket.nil?
  out << @path
  out.join ':'
end