Class: ActionView::DependencyTracker

Inherits:
Object
  • Object
show all
Extended by:
ActiveSupport::Autoload
Defined in:
actionview/lib/action_view/dependency_tracker.rb,
actionview/lib/action_view/dependency_tracker/erb_tracker.rb,
actionview/lib/action_view/dependency_tracker/ripper_tracker.rb

Overview

:nodoc:

Defined Under Namespace

Classes: ERBTracker, RipperTracker

Class Method Summary collapse

Methods included from ActiveSupport::Autoload

autoload, autoload_at, autoload_under, eager_autoload, eager_load!, extended

Class Method Details

.find_dependencies(name, template, view_paths = nil) ⇒ Object


16
17
18
19
20
21
# File 'actionview/lib/action_view/dependency_tracker.rb', line 16

def self.find_dependencies(name, template, view_paths = nil)
  tracker = @trackers[template.handler]
  return [] unless tracker

  tracker.call(name, template, view_paths)
end

.register_tracker(extension, tracker) ⇒ Object


23
24
25
26
27
28
29
30
31
32
# File 'actionview/lib/action_view/dependency_tracker.rb', line 23

def self.register_tracker(extension, tracker)
  handler = Template.handler_for_extension(extension)
  if tracker.respond_to?(:supports_view_paths?)
    @trackers[handler] = tracker
  else
    @trackers[handler] = lambda { |name, template, _|
      tracker.call(name, template)
    }
  end
end

.remove_tracker(handler) ⇒ Object


34
35
36
# File 'actionview/lib/action_view/dependency_tracker.rb', line 34

def self.remove_tracker(handler)
  @trackers.delete(handler)
end