Class: Ibex::Runtime::RepairSearchResult

Inherits:
Object
  • Object
show all
Defined in:
lib/ibex/runtime/repair.rb

Overview

Closed internal outcome for callers that must distinguish bounded search exhaustion from a complete search with no repair.

Constant Summary collapse

STATUSES =

: Array

%i[selected need_input exhausted not_found].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, plan:, configurations:) ⇒ RepairSearchResult

Returns a new instance of RepairSearchResult.

Raises:

  • (ArgumentError)


105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/ibex/runtime/repair.rb', line 105

def initialize(status:, plan:, configurations:)
  raise ArgumentError, "unknown repair search status #{status.inspect}" unless STATUSES.include?(status)
  unless configurations.is_a?(Integer) && configurations >= 0
    raise ArgumentError, "repair search configurations must be nonnegative"
  end
  unless (status == :selected) == plan.is_a?(RepairPlan)
    raise ArgumentError, "selected repair search status and plan must agree"
  end

  @status = status
  @plan = plan
  @configurations = configurations
  freeze
end

Instance Attribute Details

#configurationsObject (readonly)

: Integer



102
103
104
# File 'lib/ibex/runtime/repair.rb', line 102

def configurations
  @configurations
end

#planObject (readonly)

: RepairPlan?



101
102
103
# File 'lib/ibex/runtime/repair.rb', line 101

def plan
  @plan
end

#statusObject (readonly)

: Symbol



100
101
102
# File 'lib/ibex/runtime/repair.rb', line 100

def status
  @status
end

Instance Method Details

#selected?Boolean

Returns:

  • (Boolean)


121
# File 'lib/ibex/runtime/repair.rb', line 121

def selected? = @status == :selected