Sha256: 1a1631fb19516b71774e239780410c59312c062b835513ef4614a984a9959ece

Contents?: true

Size: 423 Bytes

Versions: 7

Compression:

Stored size: 423 Bytes

Contents

module NodeRb

  class BackWorker < Thread

    def initialize block
      super do
        block.call
      end
    end

  end

  class << self

    def defer work = nil, callback = nil, &block
      work = block if not work and block
      callback = block if not callback and block
      work ||= proc { }
      callback ||= proc { |result| }
      NodeRb.defer_native(BackWorker.new(work), callback)
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
noderb-0.0.12 lib/noderb/defer.rb
noderb-0.0.11 lib/noderb/defer.rb
noderb-0.0.10 lib/noderb/defer.rb
noderb-0.0.9 lib/noderb/defer.rb
noderb-0.0.8 lib/noderb/defer.rb
noderb-0.0.7 lib/noderb/defer.rb
noderb-0.0.6 lib/noderb/defer.rb