Module: Validate
- Defined in:
- lib/validate/validations/meta.rb,
lib/validate.rb,
lib/validate/parser.rb,
lib/validate/version.rb,
lib/validate/validator.rb,
lib/validate/validations.rb
Overview
This is the sillyness required to implement the DSL for the validations file.
Metaprogramming woooooo, though!
Defined Under Namespace
Modules: ClassMethods Classes: BlockParsingContext, CompiledValidations, Parser, ValidationMethods, Validator
Constant Summary collapse
- VERSION =
'1.3.3'
Class Method Summary collapse
Instance Method Summary collapse
- #failures ⇒ Object
-
#validates? ⇒ Boolean
May throw a nil NoMethodError if validations are not defined properly.
Class Method Details
.included(klass) ⇒ Object
20 21 22 |
# File 'lib/validate.rb', line 20 def self.included(klass) klass.extend(ClassMethods) end |
Instance Method Details
#failures ⇒ Object
31 32 33 34 |
# File 'lib/validate.rb', line 31 def failures return [] unless @validator @validator.failures end |
#validates? ⇒ Boolean
May throw a nil NoMethodError if validations are not defined properly.
26 27 28 29 |
# File 'lib/validate.rb', line 26 def validates? @validator = self.class.validations.dup @validator.validates?(self) end |