Module: Howitzer::Web::PageValidator
- Included in:
- Page
- Defined in:
- lib/howitzer/web/page_validator.rb
Overview
This module combines page validation methods
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
-
.validations ⇒ Hash
Defined validations for all page classes.
Instance Method Summary collapse
-
#check_validations_are_defined! ⇒ Object
Checks if any validations are defined for the page.
Class Method Details
.included(base) ⇒ Object
:nodoc:
9 10 11 |
# File 'lib/howitzer/web/page_validator.rb', line 9 def self.included(base) # :nodoc: base.extend(ClassMethods) end |
.validations ⇒ Hash
Returns defined validations for all page classes.
15 16 17 |
# File 'lib/howitzer/web/page_validator.rb', line 15 def self.validations @validations ||= {} end |
Instance Method Details
#check_validations_are_defined! ⇒ Object
Checks if any validations are defined for the page
22 23 24 25 26 |
# File 'lib/howitzer/web/page_validator.rb', line 22 def check_validations_are_defined! return if self.class.validations.present? raise Howitzer::NoValidationError, "No any page validation was found for '#{self.class.name}' page" end |