class ActionDispatch::Routing::Mapper::Mapping

def check_part(name, part, path_params, hash)

def check_part(name, part, path_params, hash)
  if part
    hash[name] = yield(part)
  else
    unless path_params.include?(name)
      message = "Missing :#{name} key on routes definition, please check your routes."
      raise ArgumentError, message
    end
  end
  hash
end