class Nanoc::CLI::CompileListeners::Abstract

Public Class Methods

enable_for?(command_runner, site) click to toggle source
# File lib/nanoc/cli/compile_listeners/abstract.rb, line 9
def self.enable_for?(command_runner, site) # rubocop:disable Lint/UnusedMethodArgument
  true
end
new(*) click to toggle source
Calls superclass method
# File lib/nanoc/cli/compile_listeners/abstract.rb, line 5
def initialize(*)
  super()
end

Public Instance Methods

on(sym) { |*args| ... } click to toggle source
# File lib/nanoc/cli/compile_listeners/abstract.rb, line 53
def on(sym)
  @_notification_names << sym
  Nanoc::Core::NotificationCenter.on(sym, self) { |*args| yield(*args) }
end
run_while() { || ... } click to toggle source
# File lib/nanoc/cli/compile_listeners/abstract.rb, line 36
def run_while
  wrapped_start
  yield
ensure
  wrapped_stop
end
start() click to toggle source

@abstract

# File lib/nanoc/cli/compile_listeners/abstract.rb, line 14
def start
  raise NotImplementedError, "Subclasses of #{self.class} must implement #start"
end
start_safely() click to toggle source
# File lib/nanoc/cli/compile_listeners/abstract.rb, line 43
def start_safely
  wrapped_start
  @_started = true
end
stop() click to toggle source

@abstract

# File lib/nanoc/cli/compile_listeners/abstract.rb, line 19
def stop; end
stop_safely() click to toggle source
# File lib/nanoc/cli/compile_listeners/abstract.rb, line 48
def stop_safely
  wrapped_stop if @_started
  @_started = false
end
wrapped_start() click to toggle source
# File lib/nanoc/cli/compile_listeners/abstract.rb, line 21
def wrapped_start
  @_notification_names = []
  start
end
wrapped_stop() click to toggle source
# File lib/nanoc/cli/compile_listeners/abstract.rb, line 26
def wrapped_stop
  stop

  Nanoc::Core::NotificationCenter.sync

  @_notification_names.each do |name|
    Nanoc::Core::NotificationCenter.remove(name, self)
  end
end