Class: Schash::Validator
- Inherits:
-
Object
- Object
- Schash::Validator
- Defined in:
- lib/schash/validator.rb
Instance Method Summary collapse
-
#initialize(&schema_block) ⇒ Validator
constructor
A new instance of Validator.
- #validate(target) ⇒ Object
Constructor Details
#initialize(&schema_block) ⇒ Validator
Returns a new instance of Validator.
3 4 5 |
# File 'lib/schash/validator.rb', line 3 def initialize(&schema_block) @validator = Schema::Rule::Hash.new(Schema::DSL.evaluate(&schema_block)) end |
Instance Method Details
#validate(target) ⇒ Object
7 8 9 |
# File 'lib/schash/validator.rb', line 7 def validate(target) @validator.validate(target) end |