Sha256: f37aa971555bbc27c36b523d2b8cab5ec9ec9570ec67fab44aeb0fa125113521

Contents?: true

Size: 637 Bytes

Versions: 9

Compression:

Stored size: 637 Bytes

Contents

# frozen_string_literal: true

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

    def self.enable_for?(command_runner) # 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

9 entries across 9 versions & 1 rubygems

Version Path
nanoc-4.8.3 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.8.2 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.8.1 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.8.0 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.7.14 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.7.13 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.7.12 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.7.11 lib/nanoc/cli/commands/compile_listeners/abstract.rb
nanoc-4.7.10 lib/nanoc/cli/commands/compile_listeners/abstract.rb