Class List Method List File List

# Module: OSX::OCClsWrapper

Includes:
  NSBehaviorAttachment, NSKVCBehaviorAttachment, OCObjWrapper
Defined in:
  src/objc/mdl_objwrapper.m,
  src/ruby/osx/objc/oc_import.rb,
  src/objc/mdl_objwrapper.m

## Overview

Utilities for communicating Objective-C classes.

Objective-C classes in Ruby world includes OCObjWrapper and extends OCClsWrapper.

## Constant Summary

### Constants included from NSBehaviorAttachment

NSBehaviorAttachment::ERRMSG_FOR_RESTRICT_NEW, NSBehaviorAttachment::OCTYPES

## Instance Method Summary (collapse)

- - (self) _objc_alias_class_method

  Aliases Objective-C method to given new name.

- - (self) _objc_alias_method

  Aliases Objective-C method to given new name.

- - (Object) method_added(sym)

  Overrides Module#method_added.

- - (String) objc_class_method_type

  Returns Objective-C type encodings of a given selector.

- - (Array) objc_class_methods

  Returns an array of Objective-C class methods of the reciever class.

- - (String) objc_instance_method_type

  Returns Objective-C type encodings of a given selector.

- - (Array) objc_instance_methods

  Returns an array of Objective-C instance methods of the reciever class.

- - (Object) singleton_method_added(sym)

  Overrides BasicObject#singleton_method_added.

### Methods included from NSKVCBehaviorAttachment

#kvc_accessor, #kvc_array_accessor, #kvc_depends_on, #kvc_reader, #kvc_wrapper, #kvc_wrapper_reader, #kvc_wrapper_writer, #kvc_writer

### Methods included from NSBehaviorAttachment

#_no_param_method?, #_ns_behavior_method_added, #_ns_enable_override?, #_objc_export, #_types_to_typefmt, #def_objc_method, #ib_action, #ib_outlets, #new, #ns_inherited, #ns_inherited?, #ns_outlets, #ns_overrides, #objc_alias_class_method, #objc_alias_method, #objc_class_method, #objc_method

### Methods included from OCObjWrapper

#method_missing, #objc_method_type, #objc_methods, #objc_send, #ocm_respond_to?, #ocm_send, #ocnil?, #to_s

### Methods included from NSKeyValueCodingAttachment

#rbSetValue_forKey, #rbValueForKey

## Dynamic Method Handling

This class handles dynamic methods through the `method_missing` method in the class OSX::OCObjWrapper

## Instance Method Details

### - (`self`) _objc_alias_class_method

Aliases Objective-C method to given new name.

Parameters:

- new (`String`)
- old (`String`)

Returns:

- (`self`)

    754
    755
    756
    757
    758
    759
    760
    761

    # File 'src/objc/mdl_objwrapper.m', line 754

    static VALUE
    wrapper_objc_alias_class_method (VALUE rcv, VALUE new, VALUE old)
    {
      id oc_rcv;
      rbobj_to_nsobj(rcv, &oc_rcv);
      _objc_alias_method(object_getClass(oc_rcv), new, old);
      return rcv;
    }

### - (`self`) _objc_alias_method

Aliases Objective-C method to given new name.

Parameters:

- new (`String`)
- old (`String`)

Returns:

- (`self`)

    739
    740
    741
    742
    743
    744
    745
    746

    # File 'src/objc/mdl_objwrapper.m', line 739

    static VALUE
    wrapper_objc_alias_method (VALUE rcv, VALUE new, VALUE old)
    {
      id oc_rcv;
      rbobj_to_nsobj(rcv, &oc_rcv);
      _objc_alias_method((Class)oc_rcv, new, old);
      return rcv;
    }

### - (`Object`) method_added(sym)

Overrides Module#method_added.

    768
    769
    770
    771

    # File 'src/ruby/osx/objc/oc_import.rb', line 768

    def method_added(sym)
      _ns_behavior_method_added(sym, false)
      _kvc_behavior_method_added(sym)
    end

### - (`String`) objc_class_method_type

Returns Objective-C type encodings of a given selector.

Parameters:

- name (`String`)

Returns:

- (`String`)

See Also:

- OSX::OCObjWrapper#objc_method_type

    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710

    # File 'src/objc/mdl_objwrapper.m', line 699

    static VALUE
    wrapper_objc_class_method_type (VALUE rcv, VALUE name)
    {
      id oc_rcv;
      const char* str;

      rbobj_to_nsobj(rcv, &oc_rcv);
      name = _name_to_selstr (name);
      str = _objc_method_type (object_getClass(oc_rcv), StringValuePtr(name));
      if (str == NULL) return Qnil;
      return rb_str_new2(str);
    }

### - (`Array`) objc_class_methods

Returns an array of Objective-C class methods of the reciever class. Like Object#sigleton_methods.

Returns:

- (`Array`)

    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624

    # File 'src/objc/mdl_objwrapper.m', line 612

    static VALUE
    wrapper_objc_class_methods (int argc, VALUE* argv, VALUE rcv)
    {
      VALUE ary;
      id oc_rcv;
      int recur;

      recur = (argc == 0) ? 1 : RTEST(argv[0]);
      ary = rb_ary_new();
      rbobj_to_nsobj(rcv, &oc_rcv);
      _ary_push_objc_methods (ary, object_getClass(oc_rcv), recur);
      return ary;
    }

### - (`String`) objc_instance_method_type

Returns Objective-C type encodings of a given selector.

Parameters:

- name (`String`)

Returns:

- (`String`)

See Also:

- OSX::OCObjWrapper#objc_method_type

    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691

    # File 'src/objc/mdl_objwrapper.m', line 680

    static VALUE
    wrapper_objc_instance_method_type (VALUE rcv, VALUE name)
    {
      id oc_rcv;
      const char* str;

      rbobj_to_nsobj(rcv, &oc_rcv);
      name = _name_to_selstr (name);
      str = _objc_method_type (oc_rcv, StringValuePtr(name));
      if (str == NULL) return Qnil;
      return rb_str_new2(str);
    }

### - (`Array`) objc_instance_methods

Returns an array of Objective-C instance methods of the reciever class. Like Module#instance_methods.

Returns:

- (`Array`)

    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605

    # File 'src/objc/mdl_objwrapper.m', line 593

    static VALUE
    wrapper_objc_instance_methods (int argc, VALUE* argv, VALUE rcv)
    {
      VALUE ary;
      id oc_rcv;
      int recur;

      recur = (argc == 0) ? 1 : RTEST(argv[0]);
      ary = rb_ary_new();
      rbobj_to_nsobj(rcv, &oc_rcv);
      _ary_push_objc_methods (ary, oc_rcv, recur);
      return ary;
    }

### - (`Object`) singleton_method_added(sym)

Overrides BasicObject#singleton_method_added.

    763
    764
    765

    # File 'src/ruby/osx/objc/oc_import.rb', line 763

    def singleton_method_added(sym)
      _ns_behavior_method_added(sym, true)
    end