Class: CatHerder::Assets::VerbatimAsset

Inherits:
Asset
  • Object
show all
Defined in:
lib/cat_herder/assets/verbatim_asset.rb

Instance Attribute Summary

Attributes inherited from Asset

#logical_path, #partial, #source_path

Instance Method Summary collapse

Methods inherited from Asset

#asset_path, #cache_key, #compile, #dependencies, #dependency_digests, #digest, #digest_class, #initialize, #mtime, #public_file, #public_subpath, #render, #source_mtime, #stale?, #write_metadata

Constructor Details

This class inherits a constructor from CatHerder::Assets::Asset

Instance Method Details

#readObject



18
19
20
# File 'lib/cat_herder/assets/verbatim_asset.rb', line 18

def read
  File.read(source_path)
end

#writeObject



9
10
11
12
# File 'lib/cat_herder/assets/verbatim_asset.rb', line 9

def write
  (digest: digest_class.file(source_path).hexdigest)
  FileUtils.cp(source_path, public_file.tap { |file| file.dirname.mkpath }) unless partial?
end

#written?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/cat_herder/assets/verbatim_asset.rb', line 14

def written?
  partial? || super
end