Skip to content

Instantly share code, notes, and snippets.

@seanlilmateus
Forked from RobertLowe/gist:1033589
Created June 19, 2011 06:33
Show Gist options
  • Save seanlilmateus/1033832 to your computer and use it in GitHub Desktop.
Save seanlilmateus/1033832 to your computer and use it in GitHub Desktop.
class ForwardError
attr_accessor :pointer
def self.new
@pointer = Pointer.new_with_type('@')
self
end
def self.to_pointer
@pointer
end
def self.method_missing(method, *args)
if self.respond_to? method
args.empty? ? self.send(method) : self.send(method, args)
else
args.empty? ? @pointer[0].send(method) : @pointer[0].send(method, args)
end
end
end
# error = ForwardError.new
# document = NSXMLDocument.new('<?xml version="1.0" encoding="UTF-8"?>', error.to_pointer) # this will fail to parse as there is no rootElement
# error.localizedDescription
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment