-
-
Save seanlilmateus/1033832 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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