class ActionView::DependencyTracker::ERBTracker
def self.call(name, template)
def self.call(name, template) new(name, template).dependencies end
def dependencies
def dependencies render_dependencies + explicit_dependencies end
def directory
def directory name.split("/")[0..-2].join("/") end
def explicit_dependencies
def explicit_dependencies source.scan(EXPLICIT_DEPENDENCY).flatten.uniq end
def initialize(name, template)
def initialize(name, template) @name, @template = name, template end
def render_dependencies
def render_dependencies source.scan(RENDER_DEPENDENCY). collect(&:second).uniq. # render(@topic) => render("topics/topic") # render(topics) => render("topics/topic") # render(message.topics) => render("topics/topic") collect { |name| name.sub(/\A@?([a-z_]+\.)*([a-z_]+)\z/) { "#{$2.pluralize}/#{$2.singularize}" } }. # render("headline") => render("message/headline") collect { |name| name.include?("/") ? name : "#{directory}/#{name}" }. # replace quotes from string renders collect { |name| name.gsub(/["']/, "") } end
def source
def source template.source end