Module: NotNaughty::InstanceMethods
- Defined in:
- lib/not_naughty/instance_methods.rb
Instance Method Summary collapse
-
#errors ⇒ Object
Returns instance of Errors.
-
#valid? ⇒ Boolean
Returns true if all validations passed.
-
#validate ⇒ Object
Clears errors and validates.
Instance Method Details
#errors ⇒ Object
Returns instance of Errors.
5 |
# File 'lib/not_naughty/instance_methods.rb', line 5 def errors() @errors ||= ::NotNaughty::Violation.new end |
#valid? ⇒ Boolean
Returns true if all validations passed
8 9 10 11 |
# File 'lib/not_naughty/instance_methods.rb', line 8 def valid? validate errors.empty? end |
#validate ⇒ Object
Clears errors and validates.
14 15 16 17 |
# File 'lib/not_naughty/instance_methods.rb', line 14 def validate errors.clear self.class.validator.invoke self end |