Class: DataChecks::Config
- Inherits:
-
Object
- Object
- DataChecks::Config
- Defined in:
- lib/data_checks/config.rb
Instance Attribute Summary collapse
-
#backtrace_cleaner ⇒ Object
Returns the value of attribute backtrace_cleaner.
-
#checks ⇒ Object
readonly
Returns the value of attribute checks.
-
#error_handler ⇒ Object
Returns the value of attribute error_handler.
-
#notifier_options ⇒ Object
readonly
Returns the value of attribute notifier_options.
Instance Method Summary collapse
- #ensure_any(name, **options, &block) ⇒ Object
- #ensure_equal(name, **options, &block) ⇒ Object
- #ensure_less(name, **options, &block) ⇒ Object
- #ensure_more(name, **options, &block) ⇒ Object
- #ensure_no(name, **options, &block) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #notifier(name, **options) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
8 9 10 11 |
# File 'lib/data_checks/config.rb', line 8 def initialize @checks = [] @notifier_options = {} end |
Instance Attribute Details
#backtrace_cleaner ⇒ Object
Returns the value of attribute backtrace_cleaner.
6 7 8 |
# File 'lib/data_checks/config.rb', line 6 def backtrace_cleaner @backtrace_cleaner end |
#checks ⇒ Object (readonly)
Returns the value of attribute checks.
5 6 7 |
# File 'lib/data_checks/config.rb', line 5 def checks @checks end |
#error_handler ⇒ Object
Returns the value of attribute error_handler.
6 7 8 |
# File 'lib/data_checks/config.rb', line 6 def error_handler @error_handler end |
#notifier_options ⇒ Object (readonly)
Returns the value of attribute notifier_options.
5 6 7 |
# File 'lib/data_checks/config.rb', line 5 def @notifier_options end |
Instance Method Details
#ensure_any(name, **options, &block) ⇒ Object
17 18 19 |
# File 'lib/data_checks/config.rb', line 17 def ensure_any(name, **, &block) add_check(EnsureMore, name, .merge(than: 0), block) end |
#ensure_equal(name, **options, &block) ⇒ Object
29 30 31 |
# File 'lib/data_checks/config.rb', line 29 def ensure_equal(name, **, &block) add_check(EnsureEqual, name, , block) end |
#ensure_less(name, **options, &block) ⇒ Object
25 26 27 |
# File 'lib/data_checks/config.rb', line 25 def ensure_less(name, **, &block) add_check(EnsureLess, name, , block) end |
#ensure_more(name, **options, &block) ⇒ Object
21 22 23 |
# File 'lib/data_checks/config.rb', line 21 def ensure_more(name, **, &block) add_check(EnsureMore, name, , block) end |
#ensure_no(name, **options, &block) ⇒ Object
13 14 15 |
# File 'lib/data_checks/config.rb', line 13 def ensure_no(name, **, &block) add_check(EnsureNo, name, , block) end |
#notifier(name, **options) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/data_checks/config.rb', line 33 def notifier(name, **) name = name.to_s if .key?(name) raise ArgumentError, "Duplicate notifier: '#{name}'" else [:type] ||= name [name] = end end |