Sha256: 60979e31906d26ae760c1fdcdbc9081e85ef2e39bfeaf2dfff8cb8d73893a888

Contents?: true

Size: 855 Bytes

Versions: 1

Compression:

Stored size: 855 Bytes

Contents

require 'concurrent/atomic/copy_on_notify_observer_set'
require 'concurrent/atomic/copy_on_write_observer_set'

module Concurrent

  module Observable

    # @return [Object] the added observer
    def add_observer(*args, &block)
      observers.add_observer(*args, &block)
    end

    # as #add_observer but it can be used for chaning
    # @return [Observable] self
    def with_observer(*args, &block)
      add_observer *args, &block
      self
    end

    # @return [Object] the deleted observer
    def delete_observer(*args)
      observers.delete_observer(*args)
    end

    # @return [Observable] self
    def delete_observers
      observers.delete_observers
      self
    end

    # @return [Integer] the observers count
    def count_observers
      observers.count_observers
    end

    protected

    attr_accessor :observers
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
concurrent-ruby-0.6.0 lib/concurrent/observable.rb