-
-
Save panesofglass/491892 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load_assembly 'System.Core' | |
load_assembly 'System.CoreEx, Version=1.0.2521.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35' | |
load_assembly 'System.Reactive, Version=1.0.2521.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35' | |
using_clr_extensions System | |
using_clr_extensions System::Linq | |
include System | |
include System::Linq | |
class Object | |
def to_seq(type = Object) | |
System::Linq::Enumerable.method(:of_type).of(type).call(self.to_a) | |
end | |
end | |
range = (1..10).to_seq | |
observable = | |
Observable.to_observable(range).where(lambda {|next_val| next_val % 2 == 0}) | |
dispoable = observable.subscribe(Action[Object].new {|val| puts "Next value: #{val}" }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment