I want to extend the `Nokohiri::XML::Node` object into my own unique object with custom behaviors (methods).

I have the following object:

```
class RDFNode < Nokogiri::XML::Node
  def get_tag
    self.at_xpath("Path/to/tag")
  end
end

```

and the Node Factory:

```
class RDFNodeFactory
  @doc = Nokogiri::XML.parse('rdf_file.xml')

  def self.get_node(id)
    @doc.xpath_at("Path/to/rdf/node[@id=#{id}]")
  end
end

```

My question is about best Ruby practices and basic OOP in Ruby.

How can I get `RDFNodeFactory.get_node("someid")` to return an `RDFNode` instead of a `Nokogiri::XML::Node`? I used to use type casting in Java but we don't have that in Ruby.

Should I just modify `Nokogiri::XML::Node` class instead of extending it to a custom class? What is a more acceptable practice?