Module: Rumonade::ArrayExtensions::InstanceMethods

Defined in:
lib/rumonade/array.rb

Constant Summary collapse

METHODS_TO_REPLACE_WITH_MONAD =

Preserve native map and flat_map methods for performance, and flatten to support Rails (see issue #8)

[]

Instance Method Summary collapse

Instance Method Details

#bind(lam = nil, &blk) ⇒ Object



21
22
23
# File 'lib/rumonade/array.rb', line 21

def bind(lam = nil, &blk)
  inject(self.class.empty) { |arr, elt| arr + (lam || blk).call(elt).to_a }
end