Class: Ast::Merge::Ruleset::RuntimeTranslator
- Inherits:
-
Object
- Object
- Ast::Merge::Ruleset::RuntimeTranslator
- Defined in:
- lib/ast/merge/ruleset/runtime_translator.rb
Overview
Translates normalized ruleset directives into merge-facing objects.
Class Method Summary collapse
- .declaration(config, source: :ruleset_config, capability: :full) ⇒ Object
- .feature_profile(config, source: :ruleset_config, capability: :full) ⇒ Object
- .support_style(config, source:, capability: :full) ⇒ Object
Class Method Details
.declaration(config, source: :ruleset_config, capability: :full) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ast/merge/ruleset/runtime_translator.rb', line 9 def declaration(config, source: :ruleset_config, capability: :full) support_style = config.comment_style && SupportStyleResolver.call( read: config.read, source: source, capability: capability, style: config.comment_style ) RuntimeDeclaration.new( read_strategy: config.read, attachment_strategy: config.attach, comment_style: config.comment_style, render_family: config.render, capabilities: config.capabilities, logical_owners: config.logical_owners, support_style: support_style, metadata: { source: source, path: config.path }.compact ) end |
.feature_profile(config, source: :ruleset_config, capability: :full) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ast/merge/ruleset/runtime_translator.rb', line 31 def feature_profile(config, source: :ruleset_config, capability: :full) runtime = declaration(config, source: source, capability: capability) FeatureProfile.new( owner_selector: config.owners, match_key: config.match, read_strategy: runtime.read_strategy, attachment_strategy: runtime., comment_style: runtime.comment_style, render_family: runtime.render_family, support_style: runtime.support_style, capabilities: runtime.capabilities.merge( layout_aware: true, logical_owner: runtime.logical_owner? ), logical_owners: runtime.logical_owners, repair_policies: config.repair_policies, surfaces: config.surfaces, delegation_policies: config.delegation_policies, metadata: runtime. ) end |
.support_style(config, source:, capability: :full) ⇒ Object
53 54 55 |
# File 'lib/ast/merge/ruleset/runtime_translator.rb', line 53 def support_style(config, source:, capability: :full) declaration(config, source: source, capability: capability).support_style end |