edge badge
Namespace
Methods
D
N
Attributes
[R] finder
[R] name
[R] options
Class Public methods
new(options)
# File actionview/lib/action_view/digestor.rb, line 56
def initialize(options)
  @name, @finder = options.values_at(:name, :finder)
  @options = options.except(:name, :finder)
end
Instance Public methods
dependencies()
# File actionview/lib/action_view/digestor.rb, line 70
def dependencies
  DependencyTracker.find_dependencies(name, template)
rescue ActionView::MissingTemplate
  [] # File doesn't exist, so no dependencies
end
digest(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 18
def digest(options)
  options.assert_valid_keys(:name, :finder, :dependencies, :partial)

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

  # this is a correctly done double-checked locking idiom
  # (ThreadSafe::Cache'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, options)
    end
  end
end
nested_dependencies()
# File actionview/lib/action_view/digestor.rb, line 76
def nested_dependencies
  dependencies.collect do |dependency|
    dependencies = PartialDigestor.new(name: dependency, finder: finder).nested_dependencies
    dependencies.any? ? { dependency => dependencies } : dependency
  end
end