class Nanoc::Core::CompilationPhases::Abstract

Public Class Methods

new(wrapped:) click to toggle source
# File lib/nanoc/core/compilation_phases/abstract.rb, line 9
def initialize(wrapped:)
  @wrapped = wrapped
end

Public Instance Methods

call(rep, is_outdated:) click to toggle source
# File lib/nanoc/core/compilation_phases/abstract.rb, line 21
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:) click to toggle source
# File lib/nanoc/core/compilation_phases/abstract.rb, line 35
def run(_rep, is_outdated:)
  raise NotImplementedError
end
start() click to toggle source
# File lib/nanoc/core/compilation_phases/abstract.rb, line 13
def start
  @wrapped&.start
end
stop() click to toggle source
# File lib/nanoc/core/compilation_phases/abstract.rb, line 17
def stop
  @wrapped&.stop
end

Private Instance Methods

notify(sym, rep) click to toggle source
# File lib/nanoc/core/compilation_phases/abstract.rb, line 41
def notify(sym, rep)
  name = self.class.to_s.sub(/^.*::/, '')
  Nanoc::Core::NotificationCenter.post(sym, name, rep)
end