Module: Accessibility::Factory

Included in:
AX::Element
Defined in:
lib/accessibility/factory.rb

Overview

Mixin made for processing low level data from AXAPI methods.

Instance Method Summary collapse

Instance Method Details

#process(value) ⇒ Object

Processes any given data from an AXAPI function and wraps it if needed. Meant for taking a return value from Core#attribute and friends.

Generally, used to process an AXUIElementRef into a some kind of AX::Element subclass.



26
27
28
29
30
31
32
33
34
# File 'lib/accessibility/factory.rb', line 26

def process value
  return nil if value.nil? # CFGetTypeID(nil) crashes runtime
  case CFGetTypeID(value)
  when ARRAY_TYPE then process_array value
  when REF_TYPE   then process_element value
  else
    value
  end
end