class AutomationObject::State::Base
Parent composite class
Attributes
@return [AutomationObject::BluePrint::Composite::Base]
@return [AutomationObject::Driver::Driver]
Public Class Methods
@param driver [AutomationObject::Driver] driver @param blue_prints
[AutomationObject::BluePrint::Composite::Base] blue print composite @param name [Symbol] name of composite element @param parent [Object, nil] parent composite object @param location [String] string location for error/debugging purposes
AutomationObject::Composite::new
# File lib/automation_object/state/_base.rb, line 20 def initialize(driver, blue_prints, name = :top, parent = nil, location = 'top') self.driver = driver self.blue_prints = blue_prints super(name, parent, location) end
Public Instance Methods
Overriding base get_child
method @param name [Symbol] name of child @param args [Hash] args
# File lib/automation_object/state/_base.rb, line 30 def get_child(name, args) child_location = location + "[#{name}]" args.fetch(:interface).new(driver, blue_prints.send(name), name, self, child_location) end
Overriding base get_children
method @param name [Symbol] name of child @param args [Hash] args @return children [Array<Composite>] return children and names
# File lib/automation_object/state/_base.rb, line 42 def get_children(name, args) children_hash = {} blue_prints.send(name).each do |child_key, child_blue_prints| child_location = location + "[#{child_key}]" children_hash[child_key] = args.fetch(:interface).new(driver, child_blue_prints, child_key, self, child_location) end children_hash end
Recursive function to reach parent screen Can return nil if above a screen! @return [AutomationObject::State::Screen,nil]
# File lib/automation_object/state/_base.rb, line 59 def screen return nil if is_a?(Top) # Should recursively call top until parent is nil is_a?(Screen) ? self : parent.screen end
Recursive function to reach top @return [AutomationObject::State::Top]
# File lib/automation_object/state/_base.rb, line 68 def top is_a?(Top) ? self : parent.top end