Module: ValueWrapper
- Defined in:
- lib/accessibility/bridge/macruby.rb
Overview
Constant Summary collapse
- BOX_TYPES =
Map of type encodings used for unwrapping structs wrapped in an
AXValueRef
The list is order sensitive, which is why we unshift nil, but should probably be more rigorously defined at runtime.
[CGPoint, CGSize, CGRect, CFRange].map!(&:type).unshift(nil)
Instance Method Summary collapse
-
#to_ruby ⇒ Boxed
Unwrap an
AXValueRef
into theBoxed
instance that it is supposed to be.
Instance Method Details
#to_ruby ⇒ Boxed
Unwrap an AXValueRef
into the Boxed
instance that it is supposed
to be. This will only work for the most common boxed types, you will
need to check the AXAPI documentation for an up to date list.
180 181 182 183 184 185 186 187 |
# File 'lib/accessibility/bridge/macruby.rb', line 180 def to_ruby type = AXValueGetType(self) return self if type.zero? ptr = Pointer.new BOX_TYPES[type] AXValueGetValue(self, type, ptr) ptr.value.to_ruby end |