Class: S3AssetDeploy::LocalAsset

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

Direct Known Subclasses

RailsLocalAsset

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, remove_fingerprint: nil) ⇒ LocalAsset

Returns a new instance of LocalAsset.



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

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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#==(other_asset) ⇒ Object



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

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

#full_pathObject



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

def full_path
  File.join(ENV["PWD"], "public", path)
end

#mime_typeObject



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

def mime_type
  S3AssetDeploy::AssetHelper.mime_type_for_path(path).to_s
end

#original_pathObject



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

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

#to_sObject



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

def to_s
  path
end