Skip to content

Commit

Permalink
v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
z64 committed Apr 18, 2018
1 parent ab37990 commit 58df800
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## v0.4.0

This release accomplishes a small redesign of `Stack` and `Context` that makes the library simpler and more powerful for end users.

- `Discord::Middleware` has been removed
- `Discord.add_ctx_property` / `Discord.add_ctx_property!` has been removed
- Middleware can now be *any* class that implements `def call(payload, context, &block)`
- The middleware chain is advanced by `yield`-ing to the block passed to `call`
- `Context` is reimplemented as a table of references
- The client the middleware was registered on can be accessed as `context[Discord::Client]`
- Each middleware in a chain is made available on `context`, i.e. `context[MyMiddleware]`

Big thanks to @RX14 for the recommendations and code examples that were the foundation of these changes.

See the updated `README.md` and documentation for more details.

## v0.3.1

Fixes a bug where stacks were registered across event handlers incorrectly, causing events to be distributed wrongly
Expand Down
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: discordcr-middleware
version: 0.3.1
version: 0.4.0

authors:
- Zac Nowicki <zachnowicki@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion src/discordcr-middleware/version.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module DiscordMiddleware
VERSION = "0.3.1"
VERSION = "0.4.0"
end

0 comments on commit 58df800

Please sign in to comment.