Class: Formidable::Validations::Validation
- Inherits:
-
Object
- Object
- Formidable::Validations::Validation
- Defined in:
- lib/formidable/validations.rb
Direct Known Subclasses
ValidateClass, ValidateConfirmation, ValidateEquality, ValidateFormat, ValidateLength, ValidatePresence
Instance Attribute Summary collapse
-
#element ⇒ Object
readonly
Returns the value of attribute element.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(element) ⇒ Validation
constructor
A new instance of Validation.
- #message ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(element) ⇒ Validation
Returns a new instance of Validation.
96 97 98 |
# File 'lib/formidable/validations.rb', line 96 def initialize(element) @element = element end |
Instance Attribute Details
#element ⇒ Object (readonly)
Returns the value of attribute element.
95 96 97 |
# File 'lib/formidable/validations.rb', line 95 def element @element end |
Class Method Details
.register(method_name) ⇒ Object
90 91 92 93 |
# File 'lib/formidable/validations.rb', line 90 def self.register(method_name) Validations.register_validation(self, method_name) GroupValidations.register_validation(self, method_name) end |
Instance Method Details
#message ⇒ Object
104 105 106 |
# File 'lib/formidable/validations.rb', line 104 def raise NotImplementedError, "You have to redefine #message in subclasses of the Validation class" end |
#valid? ⇒ Boolean
100 101 102 |
# File 'lib/formidable/validations.rb', line 100 def valid? raise NotImplementedError, "You have to redefine #valid? in subclasses of the Validation class" end |