Class: PgCanary::RulesConfig
- Inherits:
-
Object
- Object
- PgCanary::RulesConfig
- Defined in:
- lib/pg_canary/configuration.rb
Overview
Exposes one RuleConfig per built-in rule, both as methods and via [].
config.rules.unindexed_where.enabled = true
config.rules[:leading_wildcard_like].severity = :error
Instance Method Summary collapse
- #[](name) ⇒ Object
-
#initialize ⇒ RulesConfig
constructor
A new instance of RulesConfig.
Constructor Details
#initialize ⇒ RulesConfig
Returns a new instance of RulesConfig.
33 34 35 36 37 38 39 40 |
# File 'lib/pg_canary/configuration.rb', line 33 def initialize @configs = {} Rules::Base.all.each do |klass| rule_config = RuleConfig.new(klass.) @configs[klass.rule_name] = rule_config define_singleton_method(klass.rule_name) { rule_config } end end |
Instance Method Details
#[](name) ⇒ Object
42 43 44 |
# File 'lib/pg_canary/configuration.rb', line 42 def [](name) @configs.fetch(name.to_sym) end |