We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@jca02266 should we change the order of the parameter on #while so that we could use a block instead?
require 'rx' i = 0 # Repeat until condition no longer holds source = RX::Observable.while(RX::Observable.just 42) { i += 1; i <= 3 } subscription = source.subscribe( lambda {|x| puts 'Next: ' + x.to_s }, lambda {|err| puts 'Error: ' + err.to_s }, lambda { puts 'Completed' }) # => Next: 42 # => Next: 42 # => Next: 42 # => Completed
The text was updated successfully, but these errors were encountered:
It seems like: while(condition) { action } but not,
IMHO, change the method name to something for ruby way. We must careful to use block.
Sorry, something went wrong.
How about yield_while instead?
We can accept block without changing parameter order
--- a/lib/rx/linq/observable/while.rb +++ b/lib/rx/linq/observable/while.rb @@ -1,6 +1,13 @@ module RX class <<Observable - def while(condition, source) + def while(condition_or_source, source = nil) + if block_given? + condition = Proc.new + source = condition_or_source + else + condition = condition_or_source + end + enum = Enumerator.new {|y| while condition.call y << source
We have many time considering it
Hmm.
No branches or pull requests
@jca02266 should we change the order of the parameter on #while so that we could use a block instead?
The text was updated successfully, but these errors were encountered: