Namespace
Methods
D
N
Attributes
[R] finder
[R] name
[R] options
Class Public methods
digest(name:, finder:, **options)

Supported options:

  • name - Template name

  • finder - An instance of ActionView::LookupContext

  • dependencies - An array of dependent views

  • partial - Specifies whether the template is a partial

# File actionview/lib/action_view/digestor.rb, line 25
def digest(name,, finder,, **options)
  options.assert_valid_keys(:dependencies, :partial)

  cache_key = ([ name, finder.details_key.hash ].compact + Array.wrap(options[:dependencies])).join('.')

  # this is a correctly done double-checked locking idiom
  # (Concurrent::Map's lookups have volatile semantics)
  @@cache[cache_key] || @@digest_monitor.synchronize do
    @@cache.fetch(cache_key) do # re-check under lock
      compute_and_store_digest(cache_key, name, finder, options)
    end
  end
end
new(name, finder, options = {})
# File actionview/lib/action_view/digestor.rb, line 60
def initialize(name, finder, options = {})
  @name, @finder = name, finder
  @options = options
end
Instance Public methods
dependencies()
# File actionview/lib/action_view/digestor.rb, line 74
def dependencies
  DependencyTracker.find_dependencies(name, template, finder.view_paths)
rescue ActionView::MissingTemplate
  logger.error "  '#{name}' file doesn't exist, so no dependencies"
  []
end
digest()
# File actionview/lib/action_view/digestor.rb, line 65
def digest
  Digest::MD5.hexdigest("#{source}-#{dependency_digest}").tap do |digest|
    logger.debug "  Cache digest for #{template.inspect}: #{digest}"
  end
rescue ActionView::MissingTemplate
  logger.error "  Couldn't find template for digesting: #{name}"
  ''
end
nested_dependencies()
# File actionview/lib/action_view/digestor.rb, line 81
def nested_dependencies
  dependencies.collect do |dependency|
    dependencies = PartialDigestor.new(dependency, finder).nested_dependencies
    dependencies.any? ? { dependency => dependencies } : dependency
  end
end