class ActionDispatch::Routing::Mapper::Mapping

def normalize_format(formatted)

def normalize_format(formatted)
  case formatted
  when true
    { requirements: { format: /.+/ },
      defaults:     {} }
  when Regexp
    { requirements: { format: formatted },
      defaults:     { format: nil } }
  when String
    { requirements: { format: Regexp.compile(formatted) },
      defaults:     { format: formatted } }
  else
    { requirements: {}, defaults: {} }
  end
end