Module: EasyMonads::Option::OptionFunctions
- Defined in:
- lib/easy_monads/option_functions.rb
Class Method Summary collapse
Class Method Details
.sum_option_in_hash(hash, key, option) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/easy_monads/option_functions.rb', line 5 def self.sum_option_in_hash(hash, key, option) if hash[key].is_a? Some hash[key] = hash[key].bind { |value| Some.unit(value + option.get) } else hash[key] = option end hash end |