URL v0.1.0 URL View Source

Utilities for working with URLs.

This module provides functions for parsing URLs. It is modelled on Elixir’s URI module but will also parse scheme-specific URIs such as geo, data and tel.

Link to this section Summary

Functions

Parses a url and returns a %URL{} struct that has the same shape as Elixir’s %URI{} with the addition of the p:arsed_path key

Link to this section Types

Link to this type t() View Source
t() :: %URL{
  authority: nil | binary(),
  fragment: nil | binary(),
  host: nil | binary(),
  parsed_path: nil | URL.Data.t() | URL.Geo.t() | URL.Tel.t(),
  path: nil | binary(),
  port: nil | :inet.port_number(),
  query: nil | binary(),
  scheme: nil | binary(),
  userinfo: nil | binary()
}

Link to this section Functions

Parses a url and returns a %URL{} struct that has the same shape as Elixir’s %URI{} with the addition of the p:arsed_path key.

Example

iex> URL.parse(“geo:48.198634,-16.371648,3.4;crs=wgs84;u=40.0”) %URL{

authority: nil,
fragment: nil,
host: nil,
parsed_path: %URL.Geo{
  alt: 3.4,
  lat: 48.198634,
  lng: -16.371648,
  params: %{"crs" => "wgs84", "u" => 40.0}
},
path: "48.198634,-16.371648,3.4;crs=wgs84;u=40.0",
port: nil,
query: nil,
scheme: "geo",
userinfo: nil

}