Class: Imaginary::Validators::KeyValidator
- Inherits:
-
Object
- Object
- Imaginary::Validators::KeyValidator
- Defined in:
- lib/imaginary/validators/key_validator.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(key, options) ⇒ KeyValidator
constructor
A new instance of KeyValidator.
- #valid?(object) ⇒ Boolean
Constructor Details
#initialize(key, options) ⇒ KeyValidator
Returns a new instance of KeyValidator.
9 10 11 12 |
# File 'lib/imaginary/validators/key_validator.rb', line 9 def initialize(key, ) self.key = key self. = end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
7 8 9 |
# File 'lib/imaginary/validators/key_validator.rb', line 7 def key @key end |
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/imaginary/validators/key_validator.rb', line 6 def @options end |
Instance Method Details
#valid?(object) ⇒ Boolean
14 15 16 17 18 19 20 21 |
# File 'lib/imaginary/validators/key_validator.rb', line 14 def valid?(object) validation_resut = object.include?(key) .each do |option| validation_resut = option.append(validation_resut, object) end validation_resut end |