Class: Formidable::Validations::Validation

Inherits:
Object
  • Object
show all
Defined in:
lib/formidable/validations.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#elementObject (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

#messageObject

Raises:

  • (NotImplementedError)


104
105
106
# File 'lib/formidable/validations.rb', line 104

def message
  raise NotImplementedError, "You have to redefine #message in subclasses of the Validation class"
end

#valid?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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