Method: Cocoa.attach_nsstring_getter

Defined in:
lib/cocoa/helpers.rb

.attach_nsstring_getter(method) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cocoa/helpers.rb', line 25

def self.attach_nsstring_getter method
  raw = "get_objc_#{method}".to_sym
  attach_variable raw, method, :pointer
  if /[A-Z]/ =~ method.to_s[0]
    Cocoa.const_set(method,ObjC.NSString_to_String(send(raw)))
  else
    define_singleton_method method do
      ObjC.NSString_to_String(send(raw))
    end
  end
end