module AX

Namespace container for all the accessibility objects.

Constants

DOCK

@deprecated Please use {AX::Application.dock} instead

The Mac OS X dock application.

@return [AX::Application]

MUTEX

@private

Mutex to make sure we only create one class at a time.

@return [Mutex]

UI Element for pop up buttons.

Public Class Methods

class_for(role) click to toggle source

@private

Find the class for a given role

If the class does not exist it will be created.

@param role [#to_s] @return [Class]

# File lib/accessibility/factory.rb, line 28
def class_for role
  if AX.const_defined? role, false
    AX.const_get role
  else
    create_class role
  end
end
class_for2(subrole, role) click to toggle source

@private

Find the class for a given subrole and role

If the class does not exist it will be created on demand.

@param subrole [#to_s] @param role [#to_s] @return [Class]

# File lib/accessibility/factory.rb, line 46
def class_for2 subrole, role
  if AX.const_defined? subrole, false
    AX.const_get subrole
  else
    create_class2 subrole, role
  end
end
create_class(name) click to toggle source

@private

Create a class in the {AX} namespace that has {AX::Element} as the superclass

@param name [#to_s] @return [Class]

# File lib/accessibility/factory.rb, line 62
def create_class name
  MUTEX.synchronize do
    # re-check now that we are in the critical section
    @klass = if AX.const_defined? name, false
               AX.const_get name
             else
               klass = Class.new AX::Element
               AX.const_set name, klass
             end
  end
  @klass
end
create_class2(name, superklass) click to toggle source

@private

Create a new class in the {AX} namesapce that has the given ‘superklass` as the superclass

@param name [#to_s] @param superklass [#to_s] @return [Class]

# File lib/accessibility/factory.rb, line 84
def create_class2 name, superklass
  unless AX.const_defined? superklass, false
    create_class superklass
  end
  MUTEX.synchronize do
    # re-check now that we are in the critical section
    @klass = if AX.const_defined? name, false
               AX.const_get name
             else
               klass = Class.new AX.const_get(superklass)
               AX.const_set name, klass
             end
  end
  @klass
end