Class: Nanoc::CLI::Commands::Compile::Listener Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/nanoc/cli/commands/compile.rb

Overview

This class is abstract.

Subclasses must override #start and may override #stop.

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.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeListener

Returns a new instance of Listener



26
27
# File 'lib/nanoc/cli/commands/compile.rb', line 26

def initialize(*)
end

Class Method Details

.enable_for?(command_runner) ⇒ Boolean

This method is abstract.

Returns true by default, but subclasses may override this.

Returns true if this listener should be enabled for the given command runner, false otherwise

Parameters:

  • command_runner (Nanoc::CLI::CommandRunner)

    The command runner for this listener

Returns:

  • (Boolean)

    true if this listener should be enabled for the given command runner, false otherwise



34
35
36
# File 'lib/nanoc/cli/commands/compile.rb', line 34

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

Instance Method Details

#startvoid

This method is abstract.

This method returns an undefined value.

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

Raises:

  • (NotImplementedError)


43
44
45
# File 'lib/nanoc/cli/commands/compile.rb', line 43

def start
  raise NotImplementedError, 'Subclasses of Listener should implement #start'
end

#stopvoid

This method returns an undefined value.

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



50
51
# File 'lib/nanoc/cli/commands/compile.rb', line 50

def stop
end