Class: Mutant::CLI::Command::Session::GC Private

Inherits:
Mutant::CLI::Command::Session show all
Defined in:
lib/mutant/cli/command/session.rb

Overview

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.

Subject

API:

  • private

Constant Summary collapse

NAME =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

'gc'
SHORT_DESCRIPTION =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

'Remove incompatible and old session results'
SUBCOMMANDS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

[].freeze
OPTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

%i[add_gc_options].freeze
DEFAULT_KEEP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

Result::SessionFiles::KEEP

Constants inherited from Mutant::CLI::Command::Session

RESULTS_DIR

Instance Method Summary collapse

Methods inherited from Mutant::CLI::Command

#call, command_name, #full_name, parse, short_description

Constructor Details

#initialize ⇒ GC

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 GC.

API:

  • private



243
244
245
246
# File 'lib/mutant/cli/command/session.rb', line 243

def initialize(*)
  super
  @keep = DEFAULT_KEEP
end

Instance Method Details

#action ⇒ 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.

API:

  • private



248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/mutant/cli/command/session.rb', line 248

def action
  incompatible, compatible = partition_sessions

  incompatible.each(&:delete)

  excess = compatible.length > @keep ? compatible.first(compatible.length - @keep) : []
  excess.each(&:delete)

  print("Removed #{incompatible.length + excess.length} session(s)")

  Either::Right.new(nil)
end