https://github.com/krisleech/detachment
Transparent Sub / Pub broker for Ruby objects
https://github.com/krisleech/detachment
Last synced: about 1 year ago
JSON representation
Transparent Sub / Pub broker for Ruby objects
- Host: GitHub
- URL: https://github.com/krisleech/detachment
- Owner: krisleech
- License: mit
- Created: 2013-03-07T23:52:55.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-04-04T15:41:37.000Z (about 13 years ago)
- Last Synced: 2025-03-17T04:44:45.970Z (over 1 year ago)
- Language: Ruby
- Size: 121 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Now superseded by Wisper: https://github.com/krisleech/wisper
# Detachment
A transparent Sub / Pub broker for sending messages between objects
## Installation
gem 'detachment'
## Usage
```ruby
class MyResponder
include Detachment
subscribe(:foo)
def foo(name)
raise "#{__callee__} message received with #{name}"
end
end
class MyPublisher
include Detachment
def execute
publish(:foo, 'bar')
end
end
MyPublisher.new.execute # => RuntimeError 'foo message received with bar'
```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request