Method: Cocoa.attach_singular_method

Defined in:
lib/cocoa/helpers.rb

.attach_singular_method(method, *params) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/cocoa/helpers.rb', line 37

def self.attach_singular_method method,*params
  params = params.extract_options!
  params.freeze
  if params[:args] == 0
    define_singleton_method method do
      instance = new(true)
      instance.object = ObjC.msgSend_pointer(instance.klass,method.to_s)
      instance
    end
  else
    define_singleton_method method do |*args|
      raise "hell"
    end
  end
end