Class: Lesli::ApplicationLesliValidator
- Inherits:
-
Object
- Object
- Lesli::ApplicationLesliValidator
- Defined in:
- app/validators/lesli/application_lesli_validator.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(resource) ⇒ ApplicationLesliValidator
constructor
A new instance of ApplicationLesliValidator.
- #valid? {|failures.empty?, failures| ... } ⇒ Boolean
Constructor Details
#initialize(resource) ⇒ ApplicationLesliValidator
Returns a new instance of ApplicationLesliValidator.
40 41 42 43 44 45 46 47 48 |
# File 'app/validators/lesli/application_lesli_validator.rb', line 40 def initialize(resource) # stores the resources from the database as result of the active record queries @resource = resource # stores any error found during the life-cycle of the service object @failures = [] end |
Instance Method Details
#valid? {|failures.empty?, failures| ... } ⇒ Boolean
50 51 52 53 |
# File 'app/validators/lesli/application_lesli_validator.rb', line 50 def valid? yield(failures.empty?, failures) if block_given? failures.empty? end |