class Nokogiri::XML::Node

def coerce(data)

def coerce(data)
  case data
  when XML::NodeSet
    return data
  when XML::DocumentFragment
    return data.children
  when String
    return fragment(data).children
  when Document, XML::Attr
    # unacceptable
  when XML::Node
    return data
  end
  raise ArgumentError, <<~EOERR
    Requires a Node, NodeSet or String argument, and cannot accept a #{data.class}.
    (You probably want to select a node from the Document with at() or search(), or create a new Node via Node.new().)
  EOERR
end