Class: Ast::Merge::Ruleset::RepairPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/ast/merge/ruleset/repair_policy.rb

Overview

Declarative handling policy for a named ambiguous/corruption-class seam.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, handling:, metadata: {}) ⇒ RepairPolicy

Returns a new instance of RepairPolicy.



10
11
12
13
14
# File 'lib/ast/merge/ruleset/repair_policy.rb', line 10

def initialize(kind:, handling:, metadata: {})
  @kind = kind&.to_sym
  @handling = Ast::Merge::Healer.normalize_mode(handling)
  @metadata = .dup.freeze
end

Instance Attribute Details

#handlingObject (readonly)

Returns the value of attribute handling.



8
9
10
# File 'lib/ast/merge/ruleset/repair_policy.rb', line 8

def handling
  @handling
end

#kindObject (readonly)

Returns the value of attribute kind.



8
9
10
# File 'lib/ast/merge/ruleset/repair_policy.rb', line 8

def kind
  @kind
end

#metadataObject (readonly)

Returns the value of attribute metadata.



8
9
10
# File 'lib/ast/merge/ruleset/repair_policy.rb', line 8

def 
  @metadata
end

Instance Method Details

#to_hObject



16
17
18
19
20
21
22
# File 'lib/ast/merge/ruleset/repair_policy.rb', line 16

def to_h
  {
    kind: kind,
    handling: handling,
    metadata: 
  }.compact
end