Make the RDF.Resource.Generator runtime-configurable

This commit is contained in:
Marcel Otto 2022-03-05 21:12:42 +01:00
parent 424909b1f9
commit 663b7b6ea9

View file

@ -4,9 +4,11 @@ defmodule RDF.Resource do
@type t :: IRI.t() | BlankNode.t()
@default_generator (Application.get_env(:rdf, :resource) || [generator: BlankNode])
|> Generator.config()
def generator do
Application.get_env(:rdf, :resource, generator: BlankNode)
|> Generator.config()
end
def new(), do: Generator.generate(@default_generator, nil)
def new(args), do: Generator.generate(@default_generator, args)
def new(), do: generator() |> Generator.generate(nil)
def new(args), do: generator() |> Generator.generate(args)
end