Module: Howitzer::Utils::PageValidator
- Included in:
- WebPage
- Defined in:
- lib/howitzer/utils/page_validator.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- WrongOptionError =
Class.new(StandardError)
- NoValidationError =
Class.new(StandardError)
- UnknownValidationName =
Class.new(StandardError)
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
-
.validations ⇒ Hash
Returns validation list.
Instance Method Summary collapse
-
#check_correct_page_loaded ⇒ Object
Checks that correct page has been loaded.
Class Method Details
.included(base) ⇒ Object
:nodoc:
19 20 21 |
# File 'lib/howitzer/utils/page_validator.rb', line 19 def self.included(base) #:nodoc: base.extend(ClassMethods) end |
.validations ⇒ Hash
Returns validation list
15 16 17 |
# File 'lib/howitzer/utils/page_validator.rb', line 15 def self.validations @validations end |
Instance Method Details
#check_correct_page_loaded ⇒ Object
Checks that correct page has been loaded
29 30 31 32 33 |
# File 'lib/howitzer/utils/page_validator.rb', line 29 def check_correct_page_loaded validations = PageValidator.validations[self.class.name] raise NoValidationError, "No any page validation was found" if validations.nil? validations.each {|(_, validation)| validation.call(self)} end |