README.md in junk_drawer-1.6.3 vs README.md in junk_drawer-1.7.0

- old
+ new

@@ -25,13 +25,22 @@ gem 'junk_drawer', require: 'junk_drawer/rails' ``` ### Contents -- [JunkDrawer::Callable](#junkdrawercallable) -- [JunkDrawer::Notifier](#junkdrawernotifier) -- [JunkDrawer::BulkUpdatable](#junkdrawerbulkupdatable) +- [JunkDrawer](#junkdrawer) + - [Installation](#installation) + - [Contents](#contents) + - [Usage](#usage) + - [JunkDrawer::Callable](#junkdrawercallable) + - [JunkDrawer::Notifier](#junkdrawernotifier) + - [Rails](#rails) + - [JunkDrawer::BulkUpdatable](#junkdrawerbulkupdatable) + - [Caveats](#caveats) + - [Development](#development) + - [Contributing](#contributing) + - [License](#license) ## Usage ### JunkDrawer::Callable @@ -126,9 +135,31 @@ sure you have Honeybadger required in your application and configured for this to work. 3) `:null` is a noop. If you want to disable notifications temporarily, you can configure the strategy to `:null`. + +4) To create your own custom notifier, configure `JunkDrawer::Notifier` with + a callable object as the strategy. + +```ruby +class MyNotifier + include JunkDrawer::Callable + + def call(*args) + SomeMonitoringService.notify(*args) + end +end + +JunkDrawer::Notifier.strategy = MyNotifier +``` + +```ruby +JunkDrawer::Notifier.strategy = ->(*args) { + MonitoringServiceA.notify(*args) + MonitoringServiceB.notify(*args) +} +``` If you're using Rails, you may want to configure `Notifier` based on the environment, so in your `config/environments/development.rb` you might have: ```ruby