Class: Ast::Merge::Ruleset::DelegationPolicy
- Inherits:
-
Object
- Object
- Ast::Merge::Ruleset::DelegationPolicy
- Defined in:
- lib/ast/merge/ruleset/delegation_policy.rb
Overview
Declarative delegation strategy for a named merge surface.
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
-
#surface_name ⇒ Object
readonly
Returns the value of attribute surface_name.
Instance Method Summary collapse
-
#initialize(surface_name:, strategy:, metadata: {}) ⇒ DelegationPolicy
constructor
A new instance of DelegationPolicy.
- #to_h ⇒ Object
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
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
8 9 10 |
# File 'lib/ast/merge/ruleset/delegation_policy.rb', line 8 def @metadata end |
#strategy ⇒ Object (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_name ⇒ Object (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_h ⇒ Object
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 |