class Nanoc::CLI::Commands::Compile::Listener

Listens to compilation events and reacts to them. This abstract class does not have a real implementation; subclasses should override {#start} and set up notifications to listen to.

@abstract Subclasses must override {#start} and may override {#stop}.

Public Class Methods

enable_for?(command_runner) click to toggle source

@param [Nanoc::CLI::CommandRunner] command_runner The command runner for this listener

@return [Boolean] true if this listener should be enabled for the given command runner, false otherwise

@abstract Returns `true` by default, but subclasses may override this.

# File lib/nanoc/cli/commands/compile.rb, line 34
def self.enable_for?(command_runner) # rubocop:disable Lint/UnusedMethodArgument
  true
end
new(*) click to toggle source
# File lib/nanoc/cli/commands/compile.rb, line 26
def initialize(*)
end

Public Instance Methods

start() click to toggle source

Starts the listener. Subclasses should override this method and set up listener notifications.

@return [void]

@abstract

# File lib/nanoc/cli/commands/compile.rb, line 43
def start
  raise NotImplementedError, 'Subclasses of Listener should implement #start'
end
stop() click to toggle source

Stops the listener. The default implementation removes self from all notification center observers.

@return [void]

# File lib/nanoc/cli/commands/compile.rb, line 50
def stop
end