Class: MultiSync::Resource

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/multi_sync/resource.rb

Direct Known Subclasses

LocalResource, RemoteResource

Constant Summary collapse

AWS_ATTRIBUTES =
[{
  name: :storage_class,
  type: String,
  default: 'STANDARD'
}, {
  name: :acl,
  type: String,
  default: 'public-read'
}, {
  name: :expires,
  type: String,
  required: false
}, {
  name: :cache_control,
  type: String,
  required: false
}, {
  name: :encryption,
  type: String,
  required: false
}]

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Resource

Returns a new instance of Resource.



48
49
50
51
52
# File 'lib/multi_sync/resource.rb', line 48

def initialize(*args)
  super
rescue Virtus::CoercionError => e
  raise ArgumentError, e.message
end

Instance Method Details

#<=>(other) ⇒ Object



58
59
60
# File 'lib/multi_sync/resource.rb', line 58

def <=>(other)
  path_without_root <=> other.path_without_root
end

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



62
63
64
# File 'lib/multi_sync/resource.rb', line 62

def ==(other)
  path_without_root == other.path_without_root
end

#hashObject



54
55
56
# File 'lib/multi_sync/resource.rb', line 54

def hash
  path_without_root.hash
end

#matching_etag?(other) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/multi_sync/resource.rb', line 67

def matching_etag?(other)
  etag == other.etag
end