Module: Rumonade::HashExtensions::InstanceMethods
- Defined in:
- lib/rumonade/hash.rb
Constant Summary collapse
- METHODS_TO_REPLACE_WITH_MONAD =
Preserve native
map
andflatten
methods for compatibility Monad::DEFAULT_METHODS_TO_REPLACE_WITH_MONAD - [:map, :flatten]
Instance Method Summary collapse
- #bind(lam = nil, &blk) ⇒ Object
-
#get(key) ⇒ Option
A Some containing the value associated with
key
, or None if not present.
Instance Method Details
#bind(lam = nil, &blk) ⇒ Object
21 22 23 |
# File 'lib/rumonade/hash.rb', line 21 def bind(lam = nil, &blk) inject(self.class.empty) { |hsh, elt| hsh.merge((lam || blk).call(elt)) } end |