Skip to content

Instantly share code, notes, and snippets.

@Serabe
Created July 7, 2009 10:48
Show Gist options
  • Select an option

  • Save Serabe/142019 to your computer and use it in GitHub Desktop.

Select an option

Save Serabe/142019 to your computer and use it in GitHub Desktop.
public void setDocument(IRubyObject doc) {
this.setInstanceVariable("@document", doc);
}
@JRubyMethod
public IRubyObject add_namespace_definition(ThreadContext context, IRubyObject prefix, IRubyObject href) {
Ruby ruby = context.getRuntime();
XmlNamespace ns = new XmlNamespace(ruby, prefix, href);
ns.setDocument(this.document(context));
this.getNsDefinitions(ruby).append(ns);
return ns;
}
module Nokogiri
module XML
class Namespace
attr_reader :document
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment