Class: Rulix::Validators::NotOneOfValidator
- Inherits:
-
Object
- Object
- Rulix::Validators::NotOneOfValidator
- Defined in:
- lib/rulix/validators/not_one_of_validator.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #call(value) ⇒ Object
-
#initialize(options = nil) ⇒ NotOneOfValidator
constructor
A new instance of NotOneOfValidator.
- #to_proc ⇒ Object
Constructor Details
#initialize(options = nil) ⇒ NotOneOfValidator
Returns a new instance of NotOneOfValidator.
6 7 8 9 |
# File 'lib/rulix/validators/not_one_of_validator.rb', line 6 def initialize = nil ||= [] self. = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/rulix/validators/not_one_of_validator.rb', line 4 def @options end |
Instance Method Details
#call(value) ⇒ Object
11 12 13 |
# File 'lib/rulix/validators/not_one_of_validator.rb', line 11 def call value (value && !.include?(value)) || [false, "cannot be one of #{}"] end |
#to_proc ⇒ Object
15 16 17 |
# File 'lib/rulix/validators/not_one_of_validator.rb', line 15 def to_proc method(:call) end |