class Nanoc::CLI::Commands::Compile::GCController
Controls garbage collection so that it only occurs once every 20 items
Public Class Methods
enable_for?(_command_runner)
click to toggle source
@see Listener#enable_for?
# File lib/nanoc/cli/commands/compile.rb, line 246 def self.enable_for?(_command_runner) !ENV.key?('TRAVIS') end
new(*)
click to toggle source
# File lib/nanoc/cli/commands/compile.rb, line 250 def initialize(*) @gc_count = 0 end
Public Instance Methods
start()
click to toggle source
@see Nanoc::CLI::Commands::Compile::Listener#start
# File lib/nanoc/cli/commands/compile.rb, line 255 def start Nanoc::Int::NotificationCenter.on(:compilation_started) do |_rep| if @gc_count % 20 == 0 GC.enable GC.start GC.disable end @gc_count += 1 end end
stop()
click to toggle source
@see Nanoc::CLI::Commands::Compile::Listener#stop
Calls superclass method
Nanoc::CLI::Commands::Compile::Listener#stop
# File lib/nanoc/cli/commands/compile.rb, line 267 def stop super GC.enable end