https://github.com/expede/inspector_gadget
Helpers for debugging & inspecting code flow
https://github.com/expede/inspector_gadget
debug operator
Last synced: 4 months ago
JSON representation
Helpers for debugging & inspecting code flow
- Host: GitHub
- URL: https://github.com/expede/inspector_gadget
- Owner: expede
- License: mit
- Created: 2017-01-02T03:36:30.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-02T05:09:55.000Z (over 9 years ago)
- Last Synced: 2025-04-14T01:38:38.343Z (about 1 year ago)
- Topics: debug, operator
- Language: Elixir
- Size: 9.77 KB
- Stars: 8
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# InspectorGadget
Helpers for debugging & inspecting code flow
[](https://travis-ci.org/expede/inspector_gadget) [](http://inch-ci.org/github/expede/inspector_gadget) [](https://beta.hexfaktor.org/github/expede/inspector_gadget) [](https://hex.pm/packages/inspector_gadget) [](http://hexdocs.pm/inspector_gadget/) [](https://github.com/expede/inspector_gadget/blob/master/LICENSE)
# Quick Start
```elixir
def deps do
[{:inspector_gadget, "~> 0.2.0"}]
end
```
# Summary
## Inspect Flow
```elixir
import InspectorGadget
1
|> inspect_flow
|> fn x -> x + 1 end.()
|> fn y -> y * 100 end.()
|> inspect_flow
#=> 13:34:21.997 [info] inspect_flow: 1
#=> 13:34:21.997 [info] inspect_flow: 200
```
## Overloaded Pipe
```elixir
use InspectorGadget.Pipe
1
|> fn x -> x + b end.()
|> fn y -> y * 100 end.()
|> inspect
#=> 13:42:24.250 [info] 1 |> fn(x) = 2
#=> 13:42:24.250 [info] 2 |> fn(y) = 200
#=> 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
```elixir
1
|> fn(x, y) -> x + y end.(
6 |> fn z -> z * 10 end.()
)
#=> 13:44:02.649 [info] 6 |> fn(z) = 60
#=> 13:44:02.649 [info] 1 |> fn(x, y) = 61
```