Class: Ast::Merge::Ruleset::DelegationPolicy

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

Overview

Declarative delegation strategy for a named merge surface.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(surface_name:, strategy:, metadata: {}) ⇒ DelegationPolicy

Returns a new instance of DelegationPolicy.



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

def initialize(surface_name:, strategy:, metadata: {})
  @surface_name = surface_name&.to_sym
  @strategy = strategy&.to_sym
  @metadata = .dup.freeze
end

Instance Attribute Details

#metadataObject (readonly)

Returns the value of attribute metadata.



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

def 
  @metadata
end

#strategyObject (readonly)

Returns the value of attribute strategy.



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

def strategy
  @strategy
end

#surface_nameObject (readonly)

Returns the value of attribute surface_name.



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

def surface_name
  @surface_name
end

Instance Method Details

#to_hObject



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

def to_h
  {
    surface_name: surface_name,
    strategy: strategy,
    metadata: 
  }.compact
end