Class: ReeValidator::ValidateExclusion
- Inherits:
-
Object
- Object
- ReeValidator::ValidateExclusion
- Includes:
- Ree::FnDSL
- Defined in:
- lib/ree_lib/packages/ree_validator/package/ree_validator/functions/validate_exclusion.rb
Constant Summary collapse
- ExclusionErr =
Class.new(StandardError)
Instance Method Summary collapse
Instance Method Details
#call(value, list_or_set, error = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ree_lib/packages/ree_validator/package/ree_validator/functions/validate_exclusion.rb', line 17 def call(value, list_or_set, error = nil) if list_or_set.include?(value) error ||= ExclusionErr.new( t( 'validator.exclusion.error', {list: list_or_set.to_a}, default_by_locale: :en ) ) raise error end true end |