rdf-ex/lib/rdf/sigils.ex
2017-04-10 03:06:20 +02:00

18 lines
363 B
Elixir

defmodule RDF.Sigils do
@doc ~S"""
Handles the sigil `~I` for IRIs.
Note: The given IRI string is precompiled into an IRI struct.
## Examples
iex> import RDF.Sigils
iex> ~I<http://example.com>
RDF.uri("http://example.com")
"""
defmacro sigil_I({:<<>>, _, [iri]}, []) when is_binary(iri),
do: Macro.escape(RDF.uri(iri))
end