EventMapper
EventMapper is just a small event library for Ruby I'm writing for a small side project. It's pretty simple and works pretty much the way you'd expect events to work in JavaScript.
Installation
Add this line to your application's Gemfile:
gem 'eventmapper'
And then execute:
$ bundle
Or install it yourself as:
$ gem install eventmapper
Usage
require 'eventmapper'
class Thing
include EventMapper
end
thing = Thing.new
thing.on :something do
puts "I'm an event handler!"
end
thing.fire :something
# with paramaters
@thing.on :with_params do |first, second|
puts "#{first} #{second}"
end
@thing.fire :with_params, 'hallo', 'hooman'
Contributing
- Fork it ( https://github.com/[my-github-username]/eventmapper/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request