EnsembleCast
Evaluate block in first argument.
Installation
Add this line to your application's Gemfile:
gem 'ensemble_cast'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install ensemble_cast
Usage
You can use Module#ensemble(method_name) method.
When you call ensemble(method_name),
block passed to method_name will be evaluated in the context of the first argument of the block.
example:
class Array
ensemble def my_select
select { |e| yield(e) }
end
end
[-2, -1, 0, 1, 2].my_select { even? && !negative? }
# => [0, 2]
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/tetetratra/ensemble_cast. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the EnsembleCast project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.