View Source Lexical.Formats (lexical_shared v0.5.0)

A collection of formatting functions

Link to this section Summary

Functions

Formats a name of a module Both elixir and erlang modules will format like they appear in elixir source code.

Formats an elapsed time to either seconds or milliseconds

Link to this section Types

@type time_opt() :: {:unit, unit()}
@type time_opts() :: [time_opt()]
@type unit() :: :millisecond | :second

Link to this section Functions

Link to this function

mfa(module, function, arity)

View Source
@spec module(atom()) :: String.t()

Formats a name of a module Both elixir and erlang modules will format like they appear in elixir source code.

 Format.format(MyModule)
 "MyModule"
Formats.module(Somewhat.Nested.Module)
"Somewhat.Nested.Module"
Format.format(:erlang_module)
":erlang_module"
Link to this function

plural(count, singular, plural)

View Source
@spec time(time :: non_neg_integer(), opts :: time_opts()) :: String.t()

Formats an elapsed time to either seconds or milliseconds

Examples:

Format.seconds(500, unit: :millisecond)
"0.5 seconds"
Format.format(1500, unit: :millisecond)
"1.4 seconds"
Format.format(1500)
"15 ms"