Skip to content

Instantly share code, notes, and snippets.

@RobertLowe
Created June 18, 2011 23:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save RobertLowe/1033589 to your computer and use it in GitHub Desktop.
Save RobertLowe/1033589 to your computer and use it in GitHub Desktop.
# robgleeson's fork much improved
class ErrorDelegate
attr_reader :pointer
alias_method :to_pointer, :pointer
def initialize
@pointer = Pointer.new_with_type '@'
end
def method_missing method, *args
@pointer[0].send method, *args
end
end
error = ErrorDelegate.new
document = NSXMLDocument.alloc.initWithData '<?xml version="1.0" encoding="UTF-8"?>',
options: 1 << 9,
error: error.to_pointer
p error.localizedDescription
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment