Class: Parxer::Validator::Custom
- Inherits:
-
Base
- Object
- Base
- Parxer::Validator::Custom
show all
- Defined in:
- lib/parxer/validators/custom_validator.rb
Instance Attribute Summary
Attributes inherited from Base
#config
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#id ⇒ Object
4
5
6
|
# File 'lib/parxer/validators/custom_validator.rb', line 4
def id
config[:id].to_sym
end
|
#validate ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/parxer/validators/custom_validator.rb', line 8
def validate
if !config[:condition_proc].is_a?(Proc)
raise Parxer::ValidatorError.new("'condition_proc' needs to be a Proc")
end
instance_eval(&config[:condition_proc])
end
|