Shorten the Inspect form of RDF.PrefixMap
This commit is contained in:
parent
36ab48c0e7
commit
217139deae
1 changed files with 16 additions and 0 deletions
|
@ -395,4 +395,20 @@ defmodule RDF.PrefixMap do
|
|||
def count(%RDF.PrefixMap{map: map}), do: Enumerable.count(map)
|
||||
def slice(_prefix_map), do: {:error, __MODULE__}
|
||||
end
|
||||
|
||||
defimpl Inspect do
|
||||
import Inspect.Algebra
|
||||
|
||||
def inspect(prefix_map, opts) do
|
||||
map = Map.to_list(prefix_map.map)
|
||||
open = color("%RDF.PrefixMap{", :map, opts)
|
||||
sep = color(",", :map, opts)
|
||||
close = color("}", :map, opts)
|
||||
|
||||
container_doc(open, map, close, opts, &Inspect.List.keyword/2,
|
||||
separator: sep,
|
||||
break: :strict
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue