Class: AutomationObject::State::Hook
- Defined in:
- lib/automation_object/state/hook.rb
Overview
Hook composite for managing state
Instance Attribute Summary
Attributes inherited from Base
Attributes inherited from Composite
#children, #location, #name, #parent
Instance Method Summary collapse
-
#after ⇒ Boolean?
Runs the after hook.
-
#before ⇒ Boolean?
Runs the before hook.
-
#live? ⇒ Boolean?
Return nil if no live? check, otherwise boolean.
Methods inherited from Base
#get_child, #get_children, #initialize, #screen, #top
Methods inherited from Composite
#add_has_many_relationships, #add_has_one_relationships, #get_child, #get_children, has_many, has_many_relationships, has_one, has_one_relationships, #initialize, #top
Methods included from Reflection
Methods included from CompositeHook
#after_create_run, #before_create_run, included
Constructor Details
This class inherits a constructor from AutomationObject::State::Base
Instance Method Details
#after ⇒ Boolean?
Runs the after hook
42 43 44 45 46 47 48 49 |
# File 'lib/automation_object/state/hook.rb', line 42 def after return nil if blue_prints.after.empty? hook_action = HookAction.new(driver, blue_prints.after, :hook_action, self, location + '[hook_action]') hook_action.run end |
#before ⇒ Boolean?
Runs the before hook
30 31 32 33 34 35 36 37 38 |
# File 'lib/automation_object/state/hook.rb', line 30 def before return nil if blue_prints.before.empty? hook_action = HookAction.new(driver, blue_prints.before, :hook_action, self, location + '[hook_action]') hook_action.run end |
#live? ⇒ Boolean?
Return nil if no live? check, otherwise boolean
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/automation_object/state/hook.rb', line 13 def live? before return nil if blue_prints.live?.empty? blue_prints.live?.each do |element_requirement_blueprints| hook_element_requirement = ElementRequirement.new(self, driver, element_requirement_blueprints, 1) return false unless hook_element_requirement.run end after true end |