Class: S3Sync::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/s3sync/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)


47
48
49
50
51
# File 'lib/s3sync/sync.rb', line 47

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.



45
46
47
# File 'lib/s3sync/sync.rb', line 45

def bucket
  @bucket
end

#pathObject

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

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



64
65
66
# File 'lib/s3sync/sync.rb', line 64

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

#local?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/s3sync/sync.rb', line 60

def local?
  @bucket.nil?
end

#to_sObject



53
54
55
56
57
58
# File 'lib/s3sync/sync.rb', line 53

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