Method: RxRuby::Observable#materialize

Defined in:
lib/rx_ruby/operators/single.rb

#materializeObject

Materializes the implicit notifications of an observable sequence as explicit notification values.



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/rx_ruby/operators/single.rb', line 144

def materialize
  AnonymousObservable.new do |observer|
    new_obs = RxRuby::Observer.configure do |o|

      o.on_next {|x| observer.on_next(Notification.create_on_next x) }

      o.on_error do |err|
        observer.on_next(Notification.create_on_next err)
        observer.on_completed
      end

      o.on_completed do
        observer.on_next(Notification.create_on_completed)
        observer.on_completed
      end
    end

    subscribe new_obs
  end
end