A Ruby port of Scala's for comprehension to be used in tandem with Option
.
Add this line to your application's Gemfile:
gem "for-yield"
And then execute:
$ bundle
Or install it yourself as:
$ gem install for-yield
To use the for comprehension helper:
for_ Option(1), Option(2) do |a, b|
a + b # => 3
end
This enables unwrapping multiple Option
values into a block.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Implement your feature. Patches not considered without accompanying tests.
- Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request