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)


20
21
22
23
24
# File 'lib/s3ranger/sync.rb', line 20

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.



18
19
20
# File 'lib/s3ranger/sync.rb', line 18

def bucket
  @bucket
end

#pathObject

Returns the value of attribute path.



17
18
19
# File 'lib/s3ranger/sync.rb', line 17

def path
  @path
end

Instance Method Details

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



37
38
39
# File 'lib/s3ranger/sync.rb', line 37

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

#local?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/s3ranger/sync.rb', line 33

def local?
  @bucket.nil?
end

#to_sObject



26
27
28
29
30
31
# File 'lib/s3ranger/sync.rb', line 26

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