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.

Direct Known Subclasses

DebugPrinter, DiffGenerator, FileActionPrinter, GCController, TimingRecorder

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Listener) initialize(params = {})

Returns a new instance of Listener



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

def initialize(params = {})
end

Class Method Details

+ (Boolean) enable_for?(command_runner)

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:

Returns:

  • (Boolean)

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



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

def self.enable_for?(command_runner)
  true
end

Instance Method Details

- (void) start

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)


53
54
55
# File 'lib/nanoc/cli/commands/compile.rb', line 53

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

- (void) stop

This method returns an undefined value.

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



60
61
# File 'lib/nanoc/cli/commands/compile.rb', line 60

def stop
end