class Roadie::Document

def callback(callable, dom)

def callback(callable, dom)
  if callable.respond_to?(:call)
    # Arity checking is to support the API without bumping a major version.
    # TODO: Remove on next major version (v4.0)
    if !callable.respond_to?(:parameters) || callable.parameters.size == 1
      callable.(dom)
    else
      callable.(dom, self)
    end
  end
end