Class: Nanoc::CLI::CompileListeners::Abstract Private
- Inherits:
-
Object
- Object
- Nanoc::CLI::CompileListeners::Abstract
- Defined in:
- lib/nanoc/cli/compile_listeners/abstract.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
Aggregate, DebugPrinter, DiffGenerator, FileActionPrinter, TimingRecorder
Class Method Summary collapse
-
.enable_for?(command_runner, site) ⇒ Boolean
private
rubocop:disable Lint/UnusedMethodArgument.
Instance Method Summary collapse
-
#initialize ⇒ Abstract
constructor
private
A new instance of Abstract.
- #on(sym) ⇒ Object private
- #run_while ⇒ Object private
- #start ⇒ Object abstract private
- #start_safely ⇒ Object private
- #stop ⇒ Object abstract private
- #stop_safely ⇒ Object private
- #wrapped_start ⇒ Object private
- #wrapped_stop ⇒ Object private
Constructor Details
#initialize ⇒ Abstract
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Abstract.
5 6 7 |
# File 'lib/nanoc/cli/compile_listeners/abstract.rb', line 5 def initialize(*) super() end |
Class Method Details
.enable_for?(command_runner, site) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:disable Lint/UnusedMethodArgument
9 10 11 |
# File 'lib/nanoc/cli/compile_listeners/abstract.rb', line 9 def self.enable_for?(command_runner, site) # rubocop:disable Lint/UnusedMethodArgument true end |
Instance Method Details
#on(sym) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 56 |
# 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 ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 39 40 41 |
# File 'lib/nanoc/cli/compile_listeners/abstract.rb', line 36 def run_while wrapped_start yield ensure wrapped_stop end |
#start ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/nanoc/cli/compile_listeners/abstract.rb', line 14 def start raise NotImplementedError, "Subclasses of #{self.class} must implement #start" end |
#start_safely ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 46 |
# File 'lib/nanoc/cli/compile_listeners/abstract.rb', line 43 def start_safely wrapped_start @_started = true end |
#stop ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 |
# File 'lib/nanoc/cli/compile_listeners/abstract.rb', line 19 def stop; end |
#stop_safely ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
48 49 50 51 |
# File 'lib/nanoc/cli/compile_listeners/abstract.rb', line 48 def stop_safely wrapped_stop if @_started @_started = false end |
#wrapped_start ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 24 |
# File 'lib/nanoc/cli/compile_listeners/abstract.rb', line 21 def wrapped_start @_notification_names = [] start end |
#wrapped_stop ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 29 30 31 32 33 34 |
# 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 |