Module: SitePrism::Loadable::ClassMethods
- Defined in:
- lib/site_prism/loadable.rb
Overview
[SitePrism::Loadable::ClassMethods] This exposes all of the DSL definitions users will use when generating "Loadables"
A "Loadable" is a definition whereby the page/section object once loaded must pass a boolean check
These Loadables are typically provided using the method load_validation
Instance Method Summary collapse
-
#load_validation(&block) ⇒ Proc
Appends a load validation block to the page/section class.
-
#load_validations ⇒ Array
The list of load_validations.
Instance Method Details
#load_validation(&block) ⇒ Proc
Appends a load validation block to the page/section class.
When loaded? is called, these blocks are instance_eval'd against the current page instance. This allows users to wait for
specific events to occur on the page or certain elements to be loaded before performing any actions on the page.
This block can contain up to 2 elements in an array -> The first is the physical validation test to be truthily evaluated.
If this does not pass, then the 2nd item (if defined), is output as an error message on the FailedLoadValidationError
110 111 112 |
# File 'lib/site_prism/loadable.rb', line 110 def load_validation(&block) _load_validations << block end |
#load_validations ⇒ Array
The list of load_validations. They are executed in the order they are defined.
91 92 93 94 95 96 97 |
# File 'lib/site_prism/loadable.rb', line 91 def load_validations if superclass.respond_to?(:load_validations) superclass.load_validations + _load_validations else _load_validations end end |