Class: Nanoc::Int::DependencyTracker Private

Inherits:
Object
  • Object
show all
Defined in:
lib/nanoc/base/compilation/dependency_tracker.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: Null

Instance Method Summary collapse

Constructor Details

#initialize(dependency_store) ⇒ DependencyTracker

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of DependencyTracker.



15
16
17
18
# File 'lib/nanoc/base/compilation/dependency_tracker.rb', line 15

def initialize(dependency_store)
  @dependency_store = dependency_store
  @stack = []
end

Instance Method Details

#bounce(obj) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
36
# File 'lib/nanoc/base/compilation/dependency_tracker.rb', line 33

def bounce(obj)
  enter(obj)
  exit(obj)
end

#enter(obj) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
23
24
25
26
27
# File 'lib/nanoc/base/compilation/dependency_tracker.rb', line 20

def enter(obj)
  unless @stack.empty?
    Nanoc::Int::NotificationCenter.post(:dependency_created, @stack.last, obj)
    @dependency_store.record_dependency(@stack.last, obj)
  end

  @stack.push(obj)
end

#exit(_obj) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/nanoc/base/compilation/dependency_tracker.rb', line 29

def exit(_obj)
  @stack.pop
end