Class: Nanoc::Core::DependencyTracker Private

Inherits:
Object
  • Object
show all
Includes:
ContractsSupport
Defined in:
lib/nanoc/core/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.

Direct Known Subclasses

Null

Defined Under Namespace

Classes: Null

Constant Summary collapse

C_OBJ =

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

C::Or[
  Nanoc::Core::Item,
  Nanoc::Core::Layout,
  Nanoc::Core::Configuration,
  Nanoc::Core::IdentifiableCollection
]
C_RAW_CONTENT =

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

C::Or[
  C::IterOf[C::Or[String, Regexp]],
  C::Bool
]
C_ATTR =

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

C::Or[
  C::IterOf[Symbol],
  C::Bool
]
C_ARGS =

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

C::KeywordArgs[
  raw_content: C::Optional[C_RAW_CONTENT],
  attributes: C::Optional[C_ATTR],
  compiled_content: C::Optional[C::Bool],
  path: C::Optional[C::Bool]
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ContractsSupport

enabled?, included, setup_once, warn_about_performance

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.



39
40
41
42
# File 'lib/nanoc/core/dependency_tracker.rb', line 39

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

Instance Attribute Details

#dependency_storeObject (readonly)

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.



37
38
39
# File 'lib/nanoc/core/dependency_tracker.rb', line 37

def dependency_store
  @dependency_store
end

Instance Method Details

#bounce(obj, raw_content: false, attributes: false, compiled_content: false, path: false) ⇒ 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.



67
68
69
70
# File 'lib/nanoc/core/dependency_tracker.rb', line 67

def bounce(obj, raw_content: false, attributes: false, compiled_content: false, path: false)
  enter(obj, raw_content: raw_content, attributes: attributes, compiled_content: compiled_content, path: path)
  exit
end

#enter(obj, raw_content: false, attributes: false, compiled_content: false, path: false) ⇒ 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.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/nanoc/core/dependency_tracker.rb', line 45

def enter(obj, raw_content: false, attributes: false, compiled_content: false, path: false)
  unless @stack.empty?
    Nanoc::Core::NotificationCenter.post(:dependency_created, @stack.last, obj)
    @dependency_store.record_dependency(
      @stack.last,
      obj,
      raw_content: raw_content,
      attributes: attributes,
      compiled_content: compiled_content,
      path: path,
    )
  end

  @stack.push(obj)
end

#exitObject

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.



62
63
64
# File 'lib/nanoc/core/dependency_tracker.rb', line 62

def exit
  @stack.pop
end