Class: Nanoc::Int::Compiler::Phases::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/nanoc/base/services/compiler/phases/abstract.rb

Direct Known Subclasses

Cache, MarkDone, Recalculate, Resume, Write

Instance Method Summary collapse

Constructor Details

#initialize(wrapped:) ⇒ Abstract

Returns a new instance of Abstract



7
8
9
# File 'lib/nanoc/base/services/compiler/phases/abstract.rb', line 7

def initialize(wrapped:)
  @wrapped = wrapped
end

Instance Method Details

#call(rep, is_outdated:) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/nanoc/base/services/compiler/phases/abstract.rb', line 11

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

#run(_rep, is_outdated:) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/nanoc/base/services/compiler/phases/abstract.rb', line 25

def run(_rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument
  raise NotImplementedError
end