Acting
Acting lets your objects play a role. But just for a specific duration. One of the main-concepts for a clean DCI implementation.
Installation
Add this line to your application's Gemfile:
gem 'acting'
And then execute:
$ bundle
Or install it yourself as:
$ gem install acting
Usage
It is as simple as this:
module Positivist
def speak; 'YES'; end
end
module Negativist
def speak; 'NO'; end
end
Acting.new(user1 => Positivist, user2 => Negativist).play do
model1.speak # => 'YES'
model2.speak # => 'NO'
end
model1.speak # => NoMethodError
TODO:
For now, we are only running on MRI 1.9.2/1.9.3/2.0.0. jRuby and RBX need to be configured.
There is the case of overriding a previously define method by a role, that needs to be fixed, too.
Contributing
- Fork it
- 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 new Pull Request