Class: Nanoc::Core::CompilationPhases::Abstract

Inherits:
Object
  • Object
show all
Includes:
Nanoc::Core::ContractsSupport
Defined in:
lib/nanoc/core/compilation_phases/abstract.rb

Direct Known Subclasses

Cache, MarkDone, Notify, Recalculate, Resume, Write

Instance Method Summary collapse

Methods included from Nanoc::Core::ContractsSupport

enabled?, included, setup_once, warn_about_performance

Constructor Details

#initialize(wrapped:) ⇒ Abstract

Returns a new instance of Abstract.



9
10
11
# File 'lib/nanoc/core/compilation_phases/abstract.rb', line 9

def initialize(wrapped:)
  @wrapped = wrapped
end

Instance Method Details

#call(rep, is_outdated:) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/nanoc/core/compilation_phases/abstract.rb', line 21

def call(rep, is_outdated:)
  notify(:phase_started, rep)
  run(rep, is_outdated:) do
    notify(:phase_yielded, rep)
    @wrapped.call(rep, is_outdated:)
    notify(:phase_resumed, rep)
  end
  notify(:phase_ended, rep)
rescue
  notify(:phase_aborted, rep)
  raise
end

#run(_rep, is_outdated:) ⇒ Object

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/nanoc/core/compilation_phases/abstract.rb', line 35

def run(_rep, is_outdated:)
  raise NotImplementedError
end

#startObject



13
14
15
# File 'lib/nanoc/core/compilation_phases/abstract.rb', line 13

def start
  @wrapped&.start
end

#stopObject



17
18
19
# File 'lib/nanoc/core/compilation_phases/abstract.rb', line 17

def stop
  @wrapped&.stop
end