Sha256: 4dac33484a9d02920904f5756690492be8c5ae6b51314a69c64b443cc921c4f3
Contents?: true
Size: 918 Bytes
Versions: 25
Compression:
Stored size: 918 Bytes
Contents
# frozen_string_literal: true module Nanoc::Int::Compiler::Phases class Abstract include Nanoc::Int::ContractsSupport def initialize(wrapped:) @wrapped = wrapped end 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 contract Nanoc::Int::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any def run(_rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument raise NotImplementedError end private def notify(sym, rep) name = self.class.to_s.sub(/^.*::/, '') Nanoc::Int::NotificationCenter.post(sym, name, rep) end end end
Version data entries
25 entries across 25 versions & 1 rubygems