class AutomationObject::BluePrint::PageObjectAdapter::HookElementRequirements

HookElementRequirements composite

Public Instance Methods

element_blueprints(composite_object = nil) click to toggle source

Convience for getting element blueprints @return [AutomationObject::BluePrint::HashAdapter::Element]

# File lib/automation_object/blue_print/page_object_adapter/hook_element_requirements.rb, line 43
def element_blueprints(composite_object = nil)
  composite_object = self unless composite_object

  # Traverse!
  return composite_object.elements[element_name] if composite_object.hash[:elements].is_a?(Hash)

  return element_blueprints(composite_object.parent) if composite_object.parent

  nil
end
element_name() click to toggle source

Get name of the element @return [Symbol] name of element

# File lib/automation_object/blue_print/page_object_adapter/hook_element_requirements.rb, line 30
def element_name
  element_name = hash[:element_name]

  case element_name
    when Symbol, String
      return element_name.to_sym
    else
      return nil
  end
end
hook_order() click to toggle source

Get the order to run the hook in @return [Array<Symbol>] list of hook methods to run in given order

# File lib/automation_object/blue_print/page_object_adapter/hook_element_requirements.rb, line 12
def hook_order
  hook_order = [:exists?] # Always put exists? first

  hash.each_key do |hook_name|
    hook_order.push(hook_name) unless %i[element_name exists?].include?(hook_name)
  end

  hook_order
end
requirement(name) click to toggle source

Get element requirement @param name [Symbol] name of requested requirement

# File lib/automation_object/blue_print/page_object_adapter/hook_element_requirements.rb, line 24
def requirement(name)
  hash[name] ||= nil
end