class Nokogiri::XML::NodeSet

def first n = nil

Get the first element of the NodeSet.
##
def first n = nil
  return self[0] unless n
  list = []
  0.upto(n - 1) do |i|
    list << self[i]
  end
  list
end