lib/polytrix/validator_registry.rb in polytrix-0.1.0 vs lib/polytrix/validator_registry.rb in polytrix-0.1.1
- old
+ new
@@ -11,14 +11,11 @@
class << self
def validators
instance.validators
end
- def register(validator, &callback)
- if block_given?
- match_rules = validator
- validator = Validator.new(match_rules, &callback)
- end
+ def register(validator, scope = {}, &callback)
+ validator = Validator.new(validator, scope, &callback) if block_given?
validators << validator
end
def validators_for(challenge)
selected_validators = validators.select { |v| v.should_validate? challenge }