class CatHerder::Assets::ErbAsset::ErbContext

Attributes

_dependencies[R]

Public Class Methods

new(logical_path) click to toggle source
# File lib/cat_herder/assets/erb_asset.rb, line 34
def initialize(logical_path)
  @_logical_path = logical_path
  @_dependencies = []
end

Public Instance Methods

compute_asset_path(logical_path, *) click to toggle source
# File lib/cat_herder/assets/erb_asset.rb, line 39
def compute_asset_path(logical_path, *)
  _dependency(logical_path).asset_path
end
glob(*logical_patterns, &block) click to toggle source
# File lib/cat_herder/assets/erb_asset.rb, line 51
def glob(*logical_patterns, &block)
  Assets.glob(*logical_patterns.map { |pattern| _expand_logical_path(pattern) }, &block)
end
render(logical_path) click to toggle source
# File lib/cat_herder/assets/erb_asset.rb, line 47
def render(logical_path)
  _dependency(logical_path).render
end
resolve(logical_path) click to toggle source
# File lib/cat_herder/assets/erb_asset.rb, line 43
def resolve(logical_path)
  _dependency(logical_path).source_path
end

Private Instance Methods

_dependency(logical_path) click to toggle source
# File lib/cat_herder/assets/erb_asset.rb, line 56
def _dependency(logical_path)
  dependency = Assets[_expand_logical_path(logical_path)]
  @_dependencies << dependency unless @_dependencies.include?(dependency)
  dependency
end
_expand_logical_path(logical_path) click to toggle source
# File lib/cat_herder/assets/erb_asset.rb, line 62
def _expand_logical_path(logical_path)
  logical_path.start_with?("./", "../") ? Pathname(@_logical_path).dirname.join(logical_path).to_s : logical_path
end