Class: Ast::Merge::Ruleset::RuntimeDeclaration
- Inherits:
-
Object
- Object
- Ast::Merge::Ruleset::RuntimeDeclaration
- Defined in:
- lib/ast/merge/ruleset/runtime_declaration.rb
Overview
Merge-facing view of ruleset declarations after translation.
Instance Attribute Summary collapse
-
#attachment_strategy ⇒ Object
readonly
Returns the value of attribute attachment_strategy.
-
#capabilities ⇒ Object
readonly
Returns the value of attribute capabilities.
-
#comment_style ⇒ Object
readonly
Returns the value of attribute comment_style.
-
#logical_owner_policies ⇒ Object
readonly
Returns the value of attribute logical_owner_policies.
-
#logical_owners ⇒ Object
readonly
Returns the value of attribute logical_owners.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#read_strategy ⇒ Object
readonly
Returns the value of attribute read_strategy.
-
#render_family ⇒ Object
readonly
Returns the value of attribute render_family.
-
#support_style ⇒ Object
readonly
Returns the value of attribute support_style.
Instance Method Summary collapse
- #comment_free? ⇒ Boolean
-
#initialize(read_strategy:, attachment_strategy:, comment_style: nil, render_family: nil, capabilities: {}, logical_owners: {}, support_style: nil, metadata: {}) ⇒ RuntimeDeclaration
constructor
A new instance of RuntimeDeclaration.
- #logical_owner? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(read_strategy:, attachment_strategy:, comment_style: nil, render_family: nil, capabilities: {}, logical_owners: {}, support_style: nil, metadata: {}) ⇒ RuntimeDeclaration
Returns a new instance of RuntimeDeclaration.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 18 def initialize( read_strategy:, attachment_strategy:, comment_style: nil, render_family: nil, capabilities: {}, logical_owners: {}, support_style: nil, metadata: {} ) @read_strategy = read_strategy&.to_sym @attachment_strategy = &.to_sym @comment_style = comment_style&.to_sym @render_family = render_family&.to_sym @capabilities = capabilities.dup.freeze @logical_owners = logical_owners.dup.freeze @logical_owner_policies = @logical_owners.map do |kind, action| LogicalOwnerPolicy.new(kind: kind, action: action) end.freeze @support_style = support_style @metadata = .dup.freeze end |
Instance Attribute Details
#attachment_strategy ⇒ Object (readonly)
Returns the value of attribute attachment_strategy.
8 9 10 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 8 def @attachment_strategy end |
#capabilities ⇒ Object (readonly)
Returns the value of attribute capabilities.
8 9 10 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 8 def capabilities @capabilities end |
#comment_style ⇒ Object (readonly)
Returns the value of attribute comment_style.
8 9 10 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 8 def comment_style @comment_style end |
#logical_owner_policies ⇒ Object (readonly)
Returns the value of attribute logical_owner_policies.
8 9 10 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 8 def logical_owner_policies @logical_owner_policies end |
#logical_owners ⇒ Object (readonly)
Returns the value of attribute logical_owners.
8 9 10 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 8 def logical_owners @logical_owners end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
8 9 10 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 8 def @metadata end |
#read_strategy ⇒ Object (readonly)
Returns the value of attribute read_strategy.
8 9 10 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 8 def read_strategy @read_strategy end |
#render_family ⇒ Object (readonly)
Returns the value of attribute render_family.
8 9 10 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 8 def render_family @render_family end |
#support_style ⇒ Object (readonly)
Returns the value of attribute support_style.
8 9 10 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 8 def support_style @support_style end |
Instance Method Details
#comment_free? ⇒ Boolean
41 42 43 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 41 def comment_free? comment_style.nil? && support_style.nil? end |
#logical_owner? ⇒ Boolean
45 46 47 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 45 def logical_owner? logical_owners.any? end |
#to_h ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/ast/merge/ruleset/runtime_declaration.rb', line 49 def to_h { read_strategy: read_strategy, attachment_strategy: , comment_style: comment_style, render_family: render_family, capabilities: capabilities, logical_owners: logical_owners, logical_owner_policies: logical_owner_policies.map(&:to_h), support_style: support_style&.to_h, metadata: , comment_free: comment_free?, logical_owner: logical_owner? }.compact end |