blueprint v0.3.0 Blueprint.Plot.Label

Convenient functions for formatting labels for graph presentation.

Link to this section Summary

Functions

Strip any undesired namespace from the given label

Convert a module or function call into a formatted string

Link to this section Functions

Link to this function strip_namespace(label, namespace \\ "Elixir")
strip_namespace(String.t(), String.t()) :: String.t()

Strip any undesired namespace from the given label.

iex> Blueprint.Plot.Label.strip_namespace("Elixir.Foo.Bar")
"Foo.Bar"

iex> Blueprint.Plot.Label.strip_namespace("Elixir.Foo.Bar", "Elixir.Foo")
"Bar"
Link to this function to_label(mod)
to_label(atom() | {atom(), atom(), integer()}) :: String.t()

Convert a module or function call into a formatted string.

iex> Blueprint.Plot.Label.to_label(:foo)
"foo"

iex> Blueprint.Plot.Label.to_label(Foo)
"Elixir.Foo"

iex> Blueprint.Plot.Label.to_label(Foo.Bar)
"Elixir.Foo.Bar"

iex> Blueprint.Plot.Label.to_label({ :foo, :test, 2 })
"foo.test/2"

iex> Blueprint.Plot.Label.to_label({ Foo, :test, 2 })
"Elixir.Foo.test/2"

iex> Blueprint.Plot.Label.to_label({ Foo.Bar, :test, 2})
"Elixir.Foo.Bar.test/2"