Inspect.Algebra.break
You're seeing just the function
break
, go back to Inspect.Algebra module for more information.
Specs
break(binary()) :: doc_break()
Returns a break document based on the given string
.
This break can be rendered as a linebreak or as the given string
,
depending on the mode
of the chosen layout.
Examples
Let's create a document by concatenating two strings with a break between them:
iex> doc = Inspect.Algebra.concat(["a", Inspect.Algebra.break("\t"), "b"])
iex> Inspect.Algebra.format(doc, 80)
["a", "\t", "b"]
Note that the break was represented with the given string, because we didn't reach a line limit. Once we do, it is replaced by a newline:
iex> break = Inspect.Algebra.break("\t")
iex> doc = Inspect.Algebra.concat([String.duplicate("a", 20), break, "b"])
iex> doc = Inspect.Algebra.group(doc)
iex> Inspect.Algebra.format(doc, 10)
["aaaaaaaaaaaaaaaaaaaa", "\n", "b"]