Class: Rabl::Tracker

Inherits:
Object
  • Object
show all
Defined in:
lib/rabl/tracker.rb

Overview

DependencyTracker for ActionView to support cache digest

Constant Summary collapse

EXTENDS_DEPENDENCY =

Matches:

extends "categories/show"
/
  extends\s*              # extends, followed by optional whitespace
  \(?                     # start an optional parenthesis for the extends call
  \s*["']([0-9a-z_\/\.]+) # the template name itself
/x
PARTIAL_DEPENDENCY =

Matches:

partial "categories/show"
/
  partial\s*              # partial, followed by optional whitespace
  \(?                     # start an optional parenthesis for the partial call
  \s*["']([0-9a-z_\/\.]+) # the template name itself
/x

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, template) ⇒ Tracker

Returns a new instance of Tracker.



24
25
26
# File 'lib/rabl/tracker.rb', line 24

def initialize(name, template)
  @name, @template = name, template
end

Class Method Details

.call(name, template) ⇒ Object



20
21
22
# File 'lib/rabl/tracker.rb', line 20

def self.call(name, template)
  new(name, template).dependencies
end

Instance Method Details

#dependenciesObject



28
29
30
# File 'lib/rabl/tracker.rb', line 28

def dependencies
  (extends_dependencies + partial_dependencies).uniq
end