Sha256: fcba4a8f59188b6ce5e09324f0bc26ae7c49557cec3cbd8be2fe44fed89dd0ba

Contents?: true

Size: 643 Bytes

Versions: 6

Compression:

Stored size: 643 Bytes

Contents

# frozen_string_literal: true

module Nanoc::CLI::Commands::CompileListeners
  class Abstract
    def initialize(*); end

    def self.enable_for?(command_runner, site) # rubocop:disable Lint/UnusedMethodArgument
      true
    end

    def start
      raise NotImplementedError, "Subclasses of #{self.class} must implement #start"
    end

    def stop; end

    def start_safely
      start
      @_started = true
    end

    def stop_safely
      stop if @_started
      @_started = false
    end

    def on(sym)
      # TODO: clean up on stop
      Nanoc::Int::NotificationCenter.on(sym, self) { |*args| yield(*args) }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nanoc-4.8.9 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.8.8 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.8.7 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.8.6 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.8.5 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.8.4 lib/nanoc/cli/commands/compile_listeners/abstract.rb