Sha256: 6dc1c41b15e3e5475401d5a3b96467a3142691f1ba8411a20dab66e58e2d9620

Contents?: true

Size: 640 Bytes

Versions: 2

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

module Nanoc
  module Int
    class Compiler
      class Stage
        def call(*args)
          notify(:stage_started)
          res = Nanoc::Int::Instrumentor.call(:stage_ran, self.class) do
            run(*args)
          end
          notify(:stage_ended)
          res
        rescue
          notify(:stage_aborted)
          raise
        end

        def run(*)
          raise NotImplementedError
        end

        private

        def notify(sym)
          name = self.class.to_s.sub(/^.*::/, '')
          Nanoc::Core::NotificationCenter.post(sym, name)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-4.11.2 lib/nanoc/base/services/compiler/stage.rb
nanoc-4.11.1 lib/nanoc/base/services/compiler/stage.rb