Class: AssetsDeployer::AssetFile

Inherits:
Object
  • Object
show all
Defined in:
lib/assets_deployer/asset_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prefix, path) ⇒ AssetFile

Returns a new instance of AssetFile.



7
8
9
10
# File 'lib/assets_deployer/asset_file.rb', line 7

def initialize(prefix, path)
  @prefix = prefix
  @path = path
end

Instance Attribute Details

#prefixObject (readonly)

Returns the value of attribute prefix.



5
6
7
# File 'lib/assets_deployer/asset_file.rb', line 5

def prefix
  @prefix
end

Instance Method Details

#bodyObject



16
17
18
# File 'lib/assets_deployer/asset_file.rb', line 16

def body
  File.new(@path)
end

#content_typeObject



20
21
22
# File 'lib/assets_deployer/asset_file.rb', line 20

def content_type
  MIME::Types.type_for(@path).first.to_s
end

#keyObject



12
13
14
# File 'lib/assets_deployer/asset_file.rb', line 12

def key
  [prefix, File.basename(@path)].join('/')
end