Class: Jekyll::Minibundle::StampFile
- Inherits:
-
Object
- Object
- Jekyll::Minibundle::StampFile
- Includes:
- AssetFileOperations, AssetFileProperties
- Defined in:
- lib/jekyll/minibundle/stamp_file.rb
Instance Attribute Summary collapse
-
#asset_destination_dir ⇒ Object
readonly
Returns the value of attribute asset_destination_dir.
-
#asset_source_path ⇒ Object
readonly
Returns the value of attribute asset_source_path.
-
#stamped_at ⇒ Object
readonly
Returns the value of attribute stamped_at.
Instance Method Summary collapse
- #destination_path_for_markup ⇒ Object
-
#initialize(site, asset_source_path, asset_destination_path, &basenamer) ⇒ StampFile
constructor
A new instance of StampFile.
-
#write(site_destination_dir) ⇒ Object
writes destination only after ‘markup` has been called.
Methods included from AssetFileProperties
#asset_destination_path, #destination, #destination_rel_dir, #extname, #modified?, #mtime, #path, #relative_path, #to_liquid, #write?
Methods included from AssetFileOperations
#add_as_static_file_to, #write_destination
Constructor Details
#initialize(site, asset_source_path, asset_destination_path, &basenamer) ⇒ StampFile
Returns a new instance of StampFile.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/jekyll/minibundle/stamp_file.rb', line 12 def initialize(site, asset_source_path, asset_destination_path, &basenamer) @site = site @basenamer = basenamer @asset_source_path = File.join(@site.source, asset_source_path) @asset_destination_dir = File.dirname(asset_destination_path) @asset_destination_extension = File.extname(asset_destination_path) @asset_destination_base_prefix = File.basename(asset_destination_path)[0 .. -(@asset_destination_extension.size + 1)] @stamped_at = nil @is_modified = false end |
Instance Attribute Details
#asset_destination_dir ⇒ Object (readonly)
Returns the value of attribute asset_destination_dir.
10 11 12 |
# File 'lib/jekyll/minibundle/stamp_file.rb', line 10 def asset_destination_dir @asset_destination_dir end |
#asset_source_path ⇒ Object (readonly)
Returns the value of attribute asset_source_path.
10 11 12 |
# File 'lib/jekyll/minibundle/stamp_file.rb', line 10 def asset_source_path @asset_source_path end |
#stamped_at ⇒ Object (readonly)
Returns the value of attribute stamped_at.
10 11 12 |
# File 'lib/jekyll/minibundle/stamp_file.rb', line 10 def stamped_at @stamped_at end |
Instance Method Details
#destination_path_for_markup ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/jekyll/minibundle/stamp_file.rb', line 23 def destination_path_for_markup # we must regenerate the fingerprint here, if at all, in order # to make sure the markup and generated file have the same # fingerprint if modified? @stamped_at = mtime @is_modified = true @_asset_stamp = nil end asset_destination_path end |
#write(site_destination_dir) ⇒ Object
writes destination only after ‘markup` has been called
37 38 39 40 41 42 43 44 45 |
# File 'lib/jekyll/minibundle/stamp_file.rb', line 37 def write(site_destination_dir) if @is_modified write_destination(site_destination_dir) @is_modified = false true else false end end |