local Rx = require 'Rx'

local Observable = Rx.Observable
local BinaryDisposable = Rx.BinaryDisposable

local AddRefObservable = Rx.Class 'Rx.AddRefObservable' {

        Observable,
            -- superclass

        _observable = false,
            -- (Observable)

        _disposable = false,
            -- (Disposable)

        __init = function(self, observable, disposable)
            self._observable = observable
            self._disposable = disposable
        end,

        _subscribe = function(self, observer)
           return BinaryDisposable(self._disposable:getDisposable(),
               self._observable:subscribe(observer))
        end

}

return AddRefObservable
