Sha256: 34889c6dfc597007ed18dd3555f9f921839e443f6bbad4c2b6fc1283c5733714

Contents?: true

Size: 585 Bytes

Versions: 4

Compression:

Stored size: 585 Bytes

Contents

# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
require_relative '../dtas'

module DTAS::WritableIter # :nodoc:
  attr_accessor :on_writable

  def writable_iter_init
    @on_writable = nil
  end

  # this is used to exchange our own writable status for the readable
  # status of the DTAS::Buffer which triggered us.
  def writable_iter
    if owr = @on_writable
      @on_writable = nil
      owr.call # this triggers readability watching of DTAS::Buffer
    end
    :ignore
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dtas-0.6.0 lib/dtas/writable_iter.rb
dtas-0.5.0 lib/dtas/writable_iter.rb
dtas-0.4.0 lib/dtas/writable_iter.rb
dtas-0.3.0 lib/dtas/writable_iter.rb