Class: Validate::Validators::Validator
- Inherits:
-
Object
- Object
- Validate::Validators::Validator
- Defined in:
- lib/validate/validators/dsl.rb
Direct Known Subclasses
Defined Under Namespace
Classes: None
Instance Method Summary collapse
-
#initialize(&block) ⇒ Validator
constructor
A new instance of Validator.
- #validate(ctx) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Validator
Returns a new instance of Validator.
23 24 25 |
# File 'lib/validate/validators/dsl.rb', line 23 def initialize(&block) @constraints = AST::DefinitionContext.create(&block) end |
Instance Method Details
#validate(ctx) ⇒ Object
27 28 29 |
# File 'lib/validate/validators/dsl.rb', line 27 def validate(ctx) @constraints.evaluate(ctx) end |