rexbug v1.0.6 Rexbug.Translator View Source

Utility module for translating Elixir syntax to the one expected by :redbug.

You probably don't need to use it directly.

Link to this section Summary

Functions

Translates the Elixir trace pattern(s) (understood by Rexbug) to the Erlang trace pattern charlist(s) understood by :redbug.

Translates the options to be passed to Rexbug.start/2 to the format expected by :redbug

Link to this section Functions

Link to this function

translate(s)

View Source
translate(Rexbug.trace_pattern()) ::
  {:ok, charlist() | atom()} | {:ok, [charlist() | atom()]} | {:error, term()}

Translates the Elixir trace pattern(s) (understood by Rexbug) to the Erlang trace pattern charlist(s) understood by :redbug.

The translated version is not necessarily the cleanest possible, but should be correct and functionally equivalent.

Example

iex> import Rexbug.Translator
iex> translate(":cowboy.start_clear/3")
{:ok, '\'cowboy\':\'start_clear\'/3'}
iex> translate("MyModule.do_sth(_, [pretty: true])")
{:ok, '\'Elixir.MyModule\':\'do_sth\'(_, [{\'pretty\', true}])'}
Link to this function

translate_options(options)

View Source
translate_options(Keyword.t()) :: {:ok, Keyword.t()} | {:error, term()}

Translates the options to be passed to Rexbug.start/2 to the format expected by :redbug

Relevant values passed as strings will be converted to charlists.