Module: StrongSchema::IgnoreChecks
- Included in:
- StrongSchema
- Defined in:
- lib/strong_schema/ignore_checks.rb
Instance Method Summary collapse
-
#add_ignore(&block) ⇒ Object
: () { (Symbol, Array) -> bool } -> void.
-
#ignore_checks ⇒ Object
: () -> Array.
-
#reset_ignores! ⇒ Object
: () -> void.
-
#should_ignore?(method, args) ⇒ Boolean
: (Symbol, Array) -> bool.
Instance Method Details
#add_ignore(&block) ⇒ Object
: () { (Symbol, Array) -> bool } -> void
6 7 8 |
# File 'lib/strong_schema/ignore_checks.rb', line 6 def add_ignore(&block) ignore_checks << block end |
#ignore_checks ⇒ Object
: () -> Array
11 12 13 |
# File 'lib/strong_schema/ignore_checks.rb', line 11 def ignore_checks @ignore_checks ||= [] end |
#reset_ignores! ⇒ Object
: () -> void
16 17 18 |
# File 'lib/strong_schema/ignore_checks.rb', line 16 def reset_ignores! @ignore_checks = [] end |
#should_ignore?(method, args) ⇒ Boolean
: (Symbol, Array) -> bool
21 22 23 |
# File 'lib/strong_schema/ignore_checks.rb', line 21 def should_ignore?(method, args) ignore_checks.any? { |check| check.call(method, args) } end |