Class: CatHerder::Assets::ErbAsset

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

Defined Under Namespace

Classes: ErbContext

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, #written?

Constructor Details

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

Instance Method Details

#readObject



15
16
17
# File 'lib/cat_herder/assets/erb_asset.rb', line 15

def read
  public_file.read
end

#writeObject



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

def write
  result, dependencies = evaluate_erb
  (digest: digest_class.hexdigest(result), dependencies: dependencies)
  public_file.tap { |file| file.dirname.mkpath }.write(result)
end