class BisectionProgress

Attributes

enabled_examples[R]
iteration[R]
start_time[R]
total_examples[R]

Public Class Methods

new(attributes = {}) click to toggle source
# File lib/rspec-search-and-destroy/bisection_progress.rb, line 4
def initialize(attributes = {})
  @iteration = attributes.fetch(:iteration) { 1 }
  @enabled_examples = attributes.fetch(:enabled_examples)
  @total_examples = attributes.fetch(:total_examples)
  @time_provider = attributes.fetch(:time_provider) { Time }
  @start_time = attributes.fetch(:start_time) { @time_provider.now }
end

Public Instance Methods

==(other) click to toggle source
# File lib/rspec-search-and-destroy/bisection_progress.rb, line 24
def ==(other)
  values.map do |v|
    self.send(v) == other.send(v)
  end.all?
end
hash() click to toggle source
# File lib/rspec-search-and-destroy/bisection_progress.rb, line 30
def hash
  values.map do |v|
    self.send(v).hash
  end.reduce(:^)
end
next_iteration(enabled_examples) click to toggle source
# File lib/rspec-search-and-destroy/bisection_progress.rb, line 12
def next_iteration(enabled_examples)
  self.class.new(iteration: iteration + 1,
                 enabled_examples: enabled_examples,
                 total_examples: total_examples,
                 time_provider: @time_provider,
                 start_time: start_time)
end
run_time() click to toggle source
# File lib/rspec-search-and-destroy/bisection_progress.rb, line 20
def run_time
  @time_provider.now - @start_time
end

Private Instance Methods

values() click to toggle source
# File lib/rspec-search-and-destroy/bisection_progress.rb, line 38
def values
  [:iteration, :enabled_examples, :total_examples]
end