AmebaConfig::Config
In-memory representation of an .ameba.yml configuration. The model is
split between rules (keys matching Group/Name) and extras (any other
top-level keys, preserved verbatim on write).
Constructors
Class methods
Write a fully-commented template containing every rule the catalog knows about, with its description and default settings. The output is valid YAML (all empty lines or comments), so reading it back yields an empty config. The intended workflow is for a user to uncomment the rules and settings they want to customise.
Instance methods
Append values to a top-level extras list, skipping duplicates.
Apply enable: ensure the rule has Enabled: true.
Read a top-level extras entry as a list of strings. Returns an empty array if the entry is missing or not a list.
Add missing settings from catalog defaults into every rule already
present in this config. Used by update so that any rule we keep has
all of its settings spelled out.
True when every entry in settings matches rule_def's defaults
exactly, with no extra keys. An empty settings hash also counts as
matching when the rule has no defaults; an empty settings against a
rule that does have defaults returns false (the user removed values
without specifying alternatives).
Merge a template config into self: add rules missing from self, and within each existing rule add any settings that are missing.
Remove the given values from a top-level extras list.
Render the config to io with descriptions as comments, rules in
alphabetical order, and rules whose settings are identical to the
catalog defaults omitted entirely. extras are written first, verbatim.
header is emitted at the top (as-is, with its own trailing newline).
When the rest of the output would be empty and empty_note is given,
the note is emitted in place of the body so the file isn't blank.
Remove a setting override so the rule's default applies again. If after removal the rule has no remaining settings (or only defaults), the rule entry itself is dropped on the next save by the omit-defaults logic.
Returns a hash of the named rule's settings, creating an empty entry if missing.