Module: Knight::InstanceMethods::ClassMethods
- Defined in:
- lib/knight/instance_methods.rb
Instance Method Summary collapse
-
#context(name) {|validator(name)| ... } ⇒ undefined
Return the validator object.
-
#validator(context = DEFAULT_CONTEXT) ⇒ Validator
Return the validator object.
Instance Method Details
#context(name) {|validator(name)| ... } ⇒ undefined
Return the validator object
91 92 93 |
# File 'lib/knight/instance_methods.rb', line 91 def context(name) yield validator(name) end |
#validator(context = DEFAULT_CONTEXT) ⇒ Validator
Return the validator object
71 72 73 74 75 |
# File 'lib/knight/instance_methods.rb', line 71 def validator(context = DEFAULT_CONTEXT) validators.fetch(context) do |key| validators[key] = Validator.new end end |