Class: Vanguard::Validator::Builder
- Inherits:
-
Object
- Object
- Vanguard::Validator::Builder
- Includes:
- DSL
- Defined in:
- lib/vanguard/validator/builder.rb
Constant Summary
Constants included from DSL
Instance Attribute Summary collapse
-
#rules ⇒ Enumerator<Rule>
readonly
private
Return rules.
Instance Method Summary collapse
-
#add(rule) ⇒ self
private
Add rule.
-
#initialize(&block) ⇒ undefined
constructor
private
Initialize object.
-
#validator ⇒ Validator
private
Return validator.
Methods included from DSL
Constructor Details
#initialize(&block) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize object
20 21 22 23 24 25 |
# File 'lib/vanguard/validator/builder.rb', line 20 def initialize(&block) @rules = [] if block_given? instance_exec(&block) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Vanguard::DSL
Instance Attribute Details
#rules ⇒ Enumerator<Rule> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return rules
12 13 14 |
# File 'lib/vanguard/validator/builder.rb', line 12 def rules @rules end |
Instance Method Details
#add(rule) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Add rule
35 36 37 38 |
# File 'lib/vanguard/validator/builder.rb', line 35 def add(rule) @rules << rule self end |