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

Instance Method Summary collapse

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

.validationsHash

Returns defined validations for all page classes.

Returns:

  • (Hash)

    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

Raises:



22
23
24
25
# 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