Module: Enumerable
- Defined in:
- lib/lab42/console/intrusive.rb
Instance Method Summary collapse
- #f(*args, &blk) ⇒ Object
- #f!(*args, &blk) ⇒ Object
- #fm(*args, &blk) ⇒ Object
- #m(*args, &blk) ⇒ Object
Instance Method Details
#f(*args, &blk) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/lab42/console/intrusive.rb', line 12 def f *args, &blk blk = Lab42::Console::Tools.make_fn(args, blk) Lab42::Lazy.new(self) do | yielder, element | yielder << element if blk.(element) end end |
#f!(*args, &blk) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/lab42/console/intrusive.rb', line 19 def f! *args, &blk blk = Lab42::Console::Tools.make_fn(args, blk) Lab42::Lazy.new(self) do | yielder, element | yielder << element unless blk.(element) end end |
#fm(*args, &blk) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/lab42/console/intrusive.rb', line 33 def fm *args, &blk blk = Lab42::Console::Tools.make_fn(args, blk) Lab42::Lazy.new(self) do | yielder, element | producer = Array(blk ? blk.(element) : element) producer.lazy.each do |ele| yielder << ele end end end |