Class: PoroValidator::Validators::RangeArrayValidator
- Inherits:
-
BaseClass
- Object
- BaseClass
- PoroValidator::Validators::RangeArrayValidator
show all
- Defined in:
- lib/poro_validator/validators/range_array_validator.rb
Overview
Instance Attribute Summary
Attributes inherited from BaseClass
#attribute
Instance Method Summary
collapse
Methods inherited from BaseClass
#__validate__, #context, #errors, #initialize, #nested?, #options, #validate, #value
Instance Method Details
#covered?(range, value) ⇒ Boolean
9
10
11
12
|
# File 'lib/poro_validator/validators/range_array_validator.rb', line 9
def covered?(range, value)
return unless range.respond_to?(:cover?)
range.cover?(value)
end
|
#included?(array, value) ⇒ Boolean
14
15
16
17
|
# File 'lib/poro_validator/validators/range_array_validator.rb', line 14
def included?(array, value)
return unless array.respond_to?(:include?)
array.include?(value)
end
|
#validate_option(option) ⇒ Object
5
6
7
|
# File 'lib/poro_validator/validators/range_array_validator.rb', line 5
def validate_option(option)
!option.nil? && (option.is_a?(::Range) || option.is_a?(::Array))
end
|