Class: Reacto::Operations::DropWhile
- Inherits:
-
Object
- Object
- Reacto::Operations::DropWhile
- Defined in:
- lib/reacto/operations/drop_while.rb
Instance Method Summary collapse
- #call(tracker) ⇒ Object
-
#initialize(predicate) ⇒ DropWhile
constructor
A new instance of DropWhile.
Constructor Details
#initialize(predicate) ⇒ DropWhile
Returns a new instance of DropWhile.
6 7 8 |
# File 'lib/reacto/operations/drop_while.rb', line 6 def initialize(predicate) @predicate = predicate end |
Instance Method Details
#call(tracker) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/reacto/operations/drop_while.rb', line 10 def call(tracker) done = false behaviour = -> (value) do done = !@predicate.call(value) unless done tracker.on_value(value) if done end Subscriptions::OperationSubscription.new(tracker, value: behaviour) end |