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::ArrayOf[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::ArrayOf[Symbol],
  C::HashOf[Symbol => C::Any],
  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.



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

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.



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

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.



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

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



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

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:,
      attributes:,
      compiled_content:,
      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.



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

def exit
  @stack.pop
end