项目作者: expede

项目描述 :
Helpers for debugging & inspecting code flow
高级语言: Elixir
项目地址: git://github.com/expede/inspector_gadget.git
创建时间: 2017-01-02T03:36:30Z
项目社区:https://github.com/expede/inspector_gadget

开源协议:MIT License

下载


InspectorGadget

Helpers for debugging & inspecting code flow

Build Status Inline docs Deps Status hex.pm version API Docs license

Quick Start

  1. def deps do
  2. [{:inspector_gadget, "~> 0.2.0"}]
  3. end

Summary

Inspect Flow

  1. import InspectorGadget
  2. 1
  3. |> inspect_flow
  4. |> fn x -> x + 1 end.()
  5. |> fn y -> y * 100 end.()
  6. |> inspect_flow
  7. #=> 13:34:21.997 [info] inspect_flow: 1
  8. #=> 13:34:21.997 [info] inspect_flow: 200

Overloaded Pipe

  1. use InspectorGadget.Pipe
  2. 1
  3. |> fn x -> x + b end.()
  4. |> fn y -> y * 100 end.()
  5. |> inspect
  6. #=> 13:42:24.250 [info] 1 |> fn(x) = 2
  7. #=> 13:42:24.250 [info] 2 |> fn(y) = 200
  8. #=> 13:42:24.250 [info] 200 |> inspect = "200"

Note that this prints in the order of evaluation, so nested expressions are expected occur in a different sequence than the code

  1. 1
  2. |> fn(x, y) -> x + y end.(
  3. 6 |> fn z -> z * 10 end.()
  4. )
  5. #=> 13:44:02.649 [info] 6 |> fn(z) = 60
  6. #=> 13:44:02.649 [info] 1 |> fn(x, y) = 61