Class: Ibex::Runtime::RepairPlan

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

Overview

Deterministically selected repair.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(edits:, configurations:) ⇒ RepairPlan

Returns a new instance of RepairPlan.

RBS:

  • (edits: Array[RepairEdit], configurations: Integer) -> void

Parameters:

  • edits: (Array[RepairEdit])
  • configurations: (Integer)


80
81
82
83
84
85
86
87
# File 'lib/ibex/runtime/repair.rb', line 80

def initialize(edits:, configurations:)
  raise ArgumentError, "repair plan must contain an edit" if edits.empty?

  @edits = edits.dup.freeze
  @cost = @edits.sum(&:cost)
  @configurations = configurations
  freeze
end

Instance Attribute Details

#configurationsInteger (readonly)

Signature:

  • Integer

Returns:

  • (Integer)


77
78
79
# File 'lib/ibex/runtime/repair.rb', line 77

def configurations
  @configurations
end

#costInteger (readonly)

Signature:

  • Integer

Returns:

  • (Integer)


76
77
78
# File 'lib/ibex/runtime/repair.rb', line 76

def cost
  @cost
end

#editsArray[RepairEdit] (readonly)

Signature:

  • Array[RepairEdit]

Returns:



75
76
77
# File 'lib/ibex/runtime/repair.rb', line 75

def edits
  @edits
end

Instance Method Details

#to_hHash[Symbol, Integer | Array[Hash[Symbol, RepairEdit::document_value]]]

RBS:

  • () -> Hash[Symbol, Integer | Array[Hash[Symbol, RepairEdit::document_value]]]

Returns:

  • (Hash[Symbol, Integer | Array[Hash[Symbol, RepairEdit::document_value]]])


90
91
92
# File 'lib/ibex/runtime/repair.rb', line 90

def to_h
  { cost: @cost, configurations: @configurations, edits: @edits.map(&:to_h).freeze }.freeze
end