Class: Ace::Support::Config::Models::ConfigGroup
- Inherits:
-
Object
- Object
- Ace::Support::Config::Models::ConfigGroup
- Defined in:
- lib/ace/support/config/models/config_group.rb
Overview
ConfigGroup represents a set of files sharing the same effective config
Constant Summary collapse
- DEFAULT_SCOPE_NAME =
Default scope name when no path rule matches and no distributed config is found
"project default"
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
rule_config: Original path rule config (before cascade merge), used for grouping - When a path rule matches, this contains only the rule’s own overrides - nil for distributed config matches or project default - Separates grouping (use rule_config) from message generation (use config).
-
#files ⇒ Object
readonly
rule_config: Original path rule config (before cascade merge), used for grouping - When a path rule matches, this contains only the rule’s own overrides - nil for distributed config matches or project default - Separates grouping (use rule_config) from message generation (use config).
-
#name ⇒ Object
readonly
rule_config: Original path rule config (before cascade merge), used for grouping - When a path rule matches, this contains only the rule’s own overrides - nil for distributed config matches or project default - Separates grouping (use rule_config) from message generation (use config).
-
#rule_config ⇒ Object
readonly
rule_config: Original path rule config (before cascade merge), used for grouping - When a path rule matches, this contains only the rule’s own overrides - nil for distributed config matches or project default - Separates grouping (use rule_config) from message generation (use config).
-
#source ⇒ Object
readonly
rule_config: Original path rule config (before cascade merge), used for grouping - When a path rule matches, this contains only the rule’s own overrides - nil for distributed config matches or project default - Separates grouping (use rule_config) from message generation (use config).
Instance Method Summary collapse
- #==(other) ⇒ Object
- #add_file(file) ⇒ Object
- #file_count ⇒ Object
-
#initialize(name:, source:, config:, files: [], rule_config: nil) ⇒ ConfigGroup
constructor
A new instance of ConfigGroup.
- #inspect ⇒ Object
Constructor Details
#initialize(name:, source:, config:, files: [], rule_config: nil) ⇒ ConfigGroup
18 19 20 21 22 23 24 25 |
# File 'lib/ace/support/config/models/config_group.rb', line 18 def initialize(name:, source:, config:, files: [], rule_config: nil) @name = name @source = source @config = config || {} @rule_config = rule_config @files = Array(files) freeze end |
Instance Attribute Details
#config ⇒ Object (readonly)
rule_config: Original path rule config (before cascade merge), used for grouping
- When a path rule matches, this contains only the rule's own overrides
- nil for distributed config matches or project default
- Separates grouping (use rule_config) from message generation (use config)
16 17 18 |
# File 'lib/ace/support/config/models/config_group.rb', line 16 def config @config end |
#files ⇒ Object (readonly)
rule_config: Original path rule config (before cascade merge), used for grouping
- When a path rule matches, this contains only the rule's own overrides
- nil for distributed config matches or project default
- Separates grouping (use rule_config) from message generation (use config)
16 17 18 |
# File 'lib/ace/support/config/models/config_group.rb', line 16 def files @files end |
#name ⇒ Object (readonly)
rule_config: Original path rule config (before cascade merge), used for grouping
- When a path rule matches, this contains only the rule's own overrides
- nil for distributed config matches or project default
- Separates grouping (use rule_config) from message generation (use config)
16 17 18 |
# File 'lib/ace/support/config/models/config_group.rb', line 16 def name @name end |
#rule_config ⇒ Object (readonly)
rule_config: Original path rule config (before cascade merge), used for grouping
- When a path rule matches, this contains only the rule's own overrides
- nil for distributed config matches or project default
- Separates grouping (use rule_config) from message generation (use config)
16 17 18 |
# File 'lib/ace/support/config/models/config_group.rb', line 16 def rule_config @rule_config end |
#source ⇒ Object (readonly)
rule_config: Original path rule config (before cascade merge), used for grouping
- When a path rule matches, this contains only the rule's own overrides
- nil for distributed config matches or project default
- Separates grouping (use rule_config) from message generation (use config)
16 17 18 |
# File 'lib/ace/support/config/models/config_group.rb', line 16 def source @source end |
Instance Method Details
#==(other) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/ace/support/config/models/config_group.rb', line 41 def ==(other) other.is_a?(self.class) && other.name == name && other.source == source && other.config == config && other.rule_config == rule_config && other.files == files end |
#add_file(file) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/ace/support/config/models/config_group.rb', line 27 def add_file(file) self.class.new( name: name, source: source, config: config, rule_config: rule_config, files: files + [file] ) end |
#file_count ⇒ Object
37 38 39 |
# File 'lib/ace/support/config/models/config_group.rb', line 37 def file_count files.length end |
#inspect ⇒ Object
50 51 52 |
# File 'lib/ace/support/config/models/config_group.rb', line 50 def inspect "#<#{self.class.name} name=#{name.inspect} files=#{files.length}>" end |