Class: AutomationObject::BluePrint::HashAdapter::HookAction
- Defined in:
- lib/automation_object/blue_print/hash_adapter/hook_action.rb
Overview
Hook action composite
Instance Attribute Summary
Attributes inherited from Composite
Attributes included from ValidationHelper
Attributes inherited from Composite
#children, #location, #name, #parent
Instance Method Summary collapse
-
#change_screen ⇒ Symbol?
Screen to change to.
- #change_to_previous_screen ⇒ Boolean
- #close_modal ⇒ Boolean
- #close_screen ⇒ Boolean
-
#empty? ⇒ Boolean
See if hook actions are empty.
-
#hook_order ⇒ Array<Symbol>
Get the order to run the hook in.
-
#length ⇒ Integer
Get length of hook actions.
-
#new_screen ⇒ Symbol?
New screen.
- #possible_screen_changes ⇒ Array
-
#reset_screen ⇒ Boolean
Reset the screen?.
- #show_modal ⇒ Symbol?
-
#sleep ⇒ Numeric
Amount of time to sleep.
-
#wait_for_elements ⇒ Array<HookElementRequirements>
Custom method for array of children instead of Hash.
Methods inherited from Composite
#create_array_children, #create_composite, #create_hash_children, #get_child, #get_children, #initialize
Methods included from ValidationHelper
#add_errors, included, #valid?
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::BluePrint::HashAdapter::Composite
Instance Method Details
#change_screen ⇒ Symbol?
Returns screen to change to
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 50 def change_screen change_screen = hash[:change_screen] case change_screen when Symbol, String return change_screen.to_sym else return nil end end |
#change_to_previous_screen ⇒ Boolean
84 85 86 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 84 def change_to_previous_screen hash[:change_to_previous_screen] ||= false end |
#close_modal ⇒ Boolean
79 80 81 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 79 def close_modal hash[:close_modal] ||= false end |
#close_screen ⇒ Boolean
74 75 76 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 74 def close_screen hash[:close_screen] ||= false end |
#empty? ⇒ Boolean
See if hook actions are empty
45 46 47 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 45 def empty? hash.keys.empty? end |
#hook_order ⇒ Array<Symbol>
Get the order to run the hook in
33 34 35 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 33 def hook_order hash.keys end |
#length ⇒ Integer
Get length of hook actions
39 40 41 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 39 def length hash.keys.length end |
#new_screen ⇒ Symbol?
Returns new screen
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 62 def new_screen new_screen = hash[:new_screen] case new_screen when Symbol, String return new_screen.to_sym else return nil end end |
#possible_screen_changes ⇒ Array
101 102 103 104 105 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 101 def possible_screen_changes return hash[:possible_screen_changes].map(&:to_sym) if hash[:possible_screen_changes].is_a?(Array) [] end |
#reset_screen ⇒ Boolean
Returns reset the screen?
108 109 110 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 108 def reset_screen hash[:reset_screen] ||= false end |
#show_modal ⇒ Symbol?
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 89 def show_modal show_modal = hash[:show_modal] case show_modal when Symbol, String return show_modal.to_sym else return nil end end |
#sleep ⇒ Numeric
Returns amount of time to sleep
113 114 115 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 113 def sleep hash[:sleep] ||= 0 end |
#wait_for_elements ⇒ Array<HookElementRequirements>
Custom method for array of children instead of Hash
119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/automation_object/blue_print/hash_adapter/hook_action.rb', line 119 def wait_for_elements return @wait_for_elements if defined? @wait_for_elements wait_for_elements = hash[:wait_for_elements] children = wait_for_elements.is_a?(Array) ? wait_for_elements : [] @wait_for_elements = create_array_children(:wait_for_elements, children, interface: HookElementRequirements, location: location + '[wait_for_elements]') @wait_for_elements end |