Class: S3AssetDeploy::RemoteAsset

Inherits:
Object
  • Object
show all
Defined in:
lib/s3_asset_deploy/remote_asset.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s3_object, remove_fingerprint: nil) ⇒ RemoteAsset

Returns a new instance of RemoteAsset.



8
9
10
11
# File 'lib/s3_asset_deploy/remote_asset.rb', line 8

def initialize(s3_object, remove_fingerprint: nil)
  @s3_object = s3_object
  @remove_fingerprint = remove_fingerprint
end

Instance Attribute Details

#s3_objectObject (readonly)

Returns the value of attribute s3_object.



6
7
8
# File 'lib/s3_asset_deploy/remote_asset.rb', line 6

def s3_object
  @s3_object
end

Instance Method Details

#==(other_asset) ⇒ Object



30
31
32
# File 'lib/s3_asset_deploy/remote_asset.rb', line 30

def ==(other_asset)
  path == other_asset.path
end

#last_modifiedObject



22
23
24
# File 'lib/s3_asset_deploy/remote_asset.rb', line 22

def last_modified
  s3_object.last_modified
end

#original_pathObject



13
14
15
16
17
18
19
20
# File 'lib/s3_asset_deploy/remote_asset.rb', line 13

def original_path
  @original_path ||=
    if @remove_fingerprint
      @remove_fingerprint.call(path)
    else
      S3AssetDeploy::AssetHelper.remove_fingerprint(path)
    end
end

#pathObject



26
27
28
# File 'lib/s3_asset_deploy/remote_asset.rb', line 26

def path
  s3_object.key
end

#to_sObject



34
35
36
# File 'lib/s3_asset_deploy/remote_asset.rb', line 34

def to_s
  path
end