Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soundtrackyourbrand/defused
A fuse wrapping macro for easy circuit breaking
https://github.com/soundtrackyourbrand/defused
Last synced: about 1 month ago
JSON representation
A fuse wrapping macro for easy circuit breaking
- Host: GitHub
- URL: https://github.com/soundtrackyourbrand/defused
- Owner: soundtrackyourbrand
- License: mit
- Created: 2017-07-24T16:12:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-30T12:18:39.000Z (about 7 years ago)
- Last Synced: 2024-04-22T12:20:57.385Z (9 months ago)
- Language: Elixir
- Size: 16.6 KB
- Stars: 5
- Watchers: 10
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Defused
[![Build Status](https://travis-ci.org/soundtrackyourbrand/defused.svg?branch=master)](https://travis-ci.org/soundtrackyourbrand/defused)
[![Inline docs](http://inch-ci.org/github/soundtrackyourbrand/defused.svg)](http://inch-ci.org/github/soundtrackyourbrand/defused)Provides a `defused/3` macro similar to `Kernel#def/2` but that wraps all calls to the provided function body in a call to the specified fuse that will check and blow the fuse as needed.
[Documentation for Defused is available online](http://hexdocs.pm/defused/).
# Usage
You first need to install a fuse, see [fuse source](https://github.com/jlouis/fuse)
```elixir
defmodule MyModule do
use Defuseddefused :fuse_name, test(arg) do
case :rand.uniform() < 0.5 do
true -> {:ok, arg}
_ -> {:error, :boom}
end
end
end
```## Installation
Add `defused` to you dependencies
```elixir
def deps do
[{:defused, "~> 0.6.0"}]
end
```