core: String.Chars protocol implementation for RDF.BlankNode

This commit is contained in:
Marcel Otto 2017-05-19 17:17:41 +02:00
parent e96060d117
commit b713361065

View file

@ -18,5 +18,10 @@ defmodule RDF.BlankNode do
do: id |> :erlang.ref_to_list |> to_string |> String.replace(~r/\<|\>/, "") |> new
def new(id) when is_atom(id) or is_integer(id),
do: id |> to_string |> new
end
defimpl String.Chars, for: RDF.BlankNode do
def to_string(%RDF.BlankNode{id: id}) do
"_:#{id}"
end
end