Class: Bartender::Asset
- Inherits:
-
Object
- Object
- Bartender::Asset
- Defined in:
- lib/bartender/asset.rb
Instance Attribute Summary collapse
-
#dest_path ⇒ Object
readonly
Returns the value of attribute dest_path.
-
#digest ⇒ Object
readonly
Returns the value of attribute digest.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#found ⇒ Object
readonly
Returns the value of attribute found.
-
#mtime ⇒ Object
readonly
Returns the value of attribute mtime.
-
#site_path ⇒ Object
readonly
Returns the value of attribute site_path.
-
#sprockets_object ⇒ Object
readonly
Returns the value of attribute sprockets_object.
-
#src_file ⇒ Object
readonly
Returns the value of attribute src_file.
Instance Method Summary collapse
-
#initialize(file, sprockets_env) ⇒ Asset
constructor
A new instance of Asset.
Constructor Details
#initialize(file, sprockets_env) ⇒ Asset
Returns a new instance of Asset.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bartender/asset.rb', line 6 def initialize(file, sprockets_env) @sprockets_object = sprockets_env[file] if @sprockets_object @found = true split_file_name = file.split("/") @file = split_file_name[-1] # asset @site_path = @sprockets_object.digest_path # folder/asset.ext?digest @src_file = @sprockets_object.pathname # asset-folder/asset.ext @dest_path = File.join(Bartender::DEFAULTS["output"], @sprockets_object.digest_path) # output/folder/asset.ext else @found = false #asset doesn't exist, return nothing end end |
Instance Attribute Details
#dest_path ⇒ Object (readonly)
Returns the value of attribute dest_path.
4 5 6 |
# File 'lib/bartender/asset.rb', line 4 def dest_path @dest_path end |
#digest ⇒ Object (readonly)
Returns the value of attribute digest.
4 5 6 |
# File 'lib/bartender/asset.rb', line 4 def digest @digest end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
4 5 6 |
# File 'lib/bartender/asset.rb', line 4 def file @file end |
#found ⇒ Object (readonly)
Returns the value of attribute found.
4 5 6 |
# File 'lib/bartender/asset.rb', line 4 def found @found end |
#mtime ⇒ Object (readonly)
Returns the value of attribute mtime.
4 5 6 |
# File 'lib/bartender/asset.rb', line 4 def mtime @mtime end |
#site_path ⇒ Object (readonly)
Returns the value of attribute site_path.
4 5 6 |
# File 'lib/bartender/asset.rb', line 4 def site_path @site_path end |
#sprockets_object ⇒ Object (readonly)
Returns the value of attribute sprockets_object.
4 5 6 |
# File 'lib/bartender/asset.rb', line 4 def sprockets_object @sprockets_object end |
#src_file ⇒ Object (readonly)
Returns the value of attribute src_file.
4 5 6 |
# File 'lib/bartender/asset.rb', line 4 def src_file @src_file end |