Class: Pull::Map
- Inherits:
-
Object
- Object
- Pull::Map
- Defined in:
- lib/pull/through/map.rb
Instance Method Summary collapse
- #call(read) ⇒ Object
-
#initialize(&block) ⇒ Map
constructor
A new instance of Map.
Constructor Details
#initialize(&block) ⇒ Map
Returns a new instance of Map.
5 6 7 |
# File 'lib/pull/through/map.rb', line 5 def initialize(&block) @block = block end |
Instance Method Details
#call(read) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pull/through/map.rb', line 9 def call(read) -> (finish, callback) { if finish on_abort.() return nil end read.(nil, -> (value) { callback.(block.call(value)) }) } end |