Class: Object

Inherits:
BasicObject
Defined in:
lib/accessibility/bridge/mri.rb

Overview

accessibility-core extensions to the Object class

Instance Method Summary collapse

Instance Method Details

#descriptionString

An alias for Object#inspect

This exists to help make code more compatible between MacRuby and CRuby.

Returns:



181
182
183
# File 'lib/accessibility/bridge/mri.rb', line 181

def description
  inspect
end

#load_plist(plist_data) ⇒ Object



447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'ext/accessibility/extras/extras.c', line 447

static
VALUE
rb_load_plist(VALUE self, VALUE plist_data)
{
  NSData* data = [NSData dataWithBytes:(void*)StringValueCStr(plist_data)
		                length:RSTRING_LEN(plist_data)];
  NSError* err = nil;
  id     plist = [NSPropertyListSerialization propertyListWithData:data
                     	                                   options:0
		                                            format:nil
       	                                                     error:&err];
  [data release];
  if (plist) {
    VALUE list = to_ruby(plist);
    [plist release];
    return list;
  }

  rb_raise(rb_eArgError, "error loading property list: '%s'",
	   [[err localizedDescription] UTF8String]);
  return Qnil; // unreachable
}

#NSContainsRect(outer, inner) ⇒ Boolean

Whether or not the outer rect completely encloses the inner rect

Parameters:

Returns:

  • (Boolean)


170
171
172
# File 'lib/accessibility/bridge/mri.rb', line 170

def NSContainsRect outer, inner
  outer.to_rect.contains? inner
end

#spin(*args) ⇒ Object

I don't think this is possible except in case of ENOMEM



753
754
755
756
757
758
759
760
761
762
# File 'ext/accessibility/bridge/bridge.c', line 753

static VALUE
rb_spin(int argc, VALUE* argv, VALUE self)
{
  if (argc == 0)
    spin(0);
  else
    spin(NUM2DBL(argv[0]));

  return self;
}

#to_rubyObject

Return a usable object from an AXAPI pointer

Given an arbitrary return value from an AXAPI function this method is called to delegate the work of actually wrapping the returned value in the correct way.



160
161
162
# File 'lib/accessibility/bridge/mri.rb', line 160

def to_ruby
  self
end