lib/optional/option/enumerable.rb in optional-0.0.4 vs lib/optional/option/enumerable.rb in optional-0.0.5
- old
+ new
@@ -1,14 +1,9 @@
module Option
module Enumerable
include ::Enumerable
- def do &block
- each &block
- self
- end
-
def to_ary
to_a
end
def flatten
@@ -18,10 +13,10 @@
def juxt(*methods)
map { |v| methods.map { |m| v.send(m) } }
end
def map_through(*methods)
- methods.reduce(self) { |acc, m| acc.map(&m) }
+ map &methods.reduce(->(x){x}){ |acc, m| ->(x) { acc.call(x).send(m) } }
end
def map
from_array super
end