Class: Ast::Merge::Ruleset::Config
- Inherits:
-
Object
- Object
- Ast::Merge::Ruleset::Config
- Defined in:
- lib/ast/merge/ruleset/config.rb
Overview
Normalized parsed merge-ruleset configuration.
Instance Attribute Summary collapse
-
#attach ⇒ Object
readonly
Returns the value of attribute attach.
-
#capabilities ⇒ Object
readonly
Returns the value of attribute capabilities.
-
#comment_style ⇒ Object
readonly
Returns the value of attribute comment_style.
-
#delegation_policies ⇒ Object
readonly
Returns the value of attribute delegation_policies.
-
#directives ⇒ Object
readonly
Returns the value of attribute directives.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#logical_owners ⇒ Object
readonly
Returns the value of attribute logical_owners.
-
#match ⇒ Object
readonly
Returns the value of attribute match.
-
#owners ⇒ Object
readonly
Returns the value of attribute owners.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#read ⇒ Object
readonly
Returns the value of attribute read.
-
#render ⇒ Object
readonly
Returns the value of attribute render.
-
#repair_policies ⇒ Object
readonly
Returns the value of attribute repair_policies.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#surfaces ⇒ Object
readonly
Returns the value of attribute surfaces.
Class Method Summary collapse
Instance Method Summary collapse
- #attachment_strategy ⇒ Object
- #feature_profile(source: :ruleset_config, capability: :full) ⇒ Object
-
#initialize(source:, format:, owners:, match:, read:, attach:, path: nil, comment_style: nil, render: nil, capabilities: {}, logical_owners: {}, repair_policies: {}, surfaces: [], delegation_policies: [], directives: []) ⇒ Config
constructor
A new instance of Config.
- #runtime_declaration(source: :ruleset_config, capability: :full) ⇒ Object
- #support_style(source:, capability: :full) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(source:, format:, owners:, match:, read:, attach:, path: nil, comment_style: nil, render: nil, capabilities: {}, logical_owners: {}, repair_policies: {}, surfaces: [], delegation_policies: [], directives: []) ⇒ Config
Returns a new instance of Config.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/ast/merge/ruleset/config.rb', line 36 def initialize( source:, format:, owners:, match:, read:, attach:, path: nil, comment_style: nil, render: nil, capabilities: {}, logical_owners: {}, repair_policies: {}, surfaces: [], delegation_policies: [], directives: [] ) @source = source.to_s @path = path @format = format @owners = owners @match = match @read = read @attach = attach @comment_style = comment_style @render = render @capabilities = capabilities.dup @logical_owners = logical_owners.dup @repair_policies = normalize_repair_policies(repair_policies) @surfaces = normalize_surfaces(surfaces) @delegation_policies = normalize_delegation_policies(delegation_policies) @directives = directives.dup end |
Instance Attribute Details
#attach ⇒ Object (readonly)
Returns the value of attribute attach.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def attach @attach end |
#capabilities ⇒ Object (readonly)
Returns the value of attribute capabilities.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.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/config.rb', line 8 def comment_style @comment_style end |
#delegation_policies ⇒ Object (readonly)
Returns the value of attribute delegation_policies.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def delegation_policies @delegation_policies end |
#directives ⇒ Object (readonly)
Returns the value of attribute directives.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def directives @directives end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def format @format end |
#logical_owners ⇒ Object (readonly)
Returns the value of attribute logical_owners.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def logical_owners @logical_owners end |
#match ⇒ Object (readonly)
Returns the value of attribute match.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def match @match end |
#owners ⇒ Object (readonly)
Returns the value of attribute owners.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def owners @owners end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def path @path end |
#read ⇒ Object (readonly)
Returns the value of attribute read.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def read @read end |
#render ⇒ Object (readonly)
Returns the value of attribute render.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def render @render end |
#repair_policies ⇒ Object (readonly)
Returns the value of attribute repair_policies.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def repair_policies @repair_policies end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def source @source end |
#surfaces ⇒ Object (readonly)
Returns the value of attribute surfaces.
8 9 10 |
# File 'lib/ast/merge/ruleset/config.rb', line 8 def surfaces @surfaces end |
Class Method Details
.load(path) ⇒ Object
25 26 27 28 29 |
# File 'lib/ast/merge/ruleset/config.rb', line 25 def load(path) raise ArgumentError, "Ruleset file not found: #{path}" unless File.exist?(path) parse(File.read(path, encoding: 'UTF-8'), path: path) end |
Instance Method Details
#attachment_strategy ⇒ Object
82 83 84 |
# File 'lib/ast/merge/ruleset/config.rb', line 82 def attach end |
#feature_profile(source: :ruleset_config, capability: :full) ⇒ Object
90 91 92 |
# File 'lib/ast/merge/ruleset/config.rb', line 90 def feature_profile(source: :ruleset_config, capability: :full) RuntimeTranslator.feature_profile(self, source: source, capability: capability) end |
#runtime_declaration(source: :ruleset_config, capability: :full) ⇒ Object
86 87 88 |
# File 'lib/ast/merge/ruleset/config.rb', line 86 def runtime_declaration(source: :ruleset_config, capability: :full) RuntimeTranslator.declaration(self, source: source, capability: capability) end |
#support_style(source:, capability: :full) ⇒ Object
94 95 96 |
# File 'lib/ast/merge/ruleset/config.rb', line 94 def support_style(source:, capability: :full) RuntimeTranslator.support_style(self, source: source, capability: capability) end |
#to_h ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/ast/merge/ruleset/config.rb', line 65 def to_h { format: format, owners: owners, match: match, read: read, attach: attach, comment_style: comment_style, render: render, capabilities: capabilities.dup, logical_owners: logical_owners.dup, repair_policies: repair_policies.map(&:to_h), surfaces: surfaces.map(&:to_h), delegation_policies: delegation_policies.map(&:to_h) }.compact end |