Sha256: e3ca62544cd63fbdf1078fcb23b7c192b4f27ce7182bc753ba726f0684e1af0b

Contents?: true

Size: 528 Bytes

Versions: 8

Compression:

Stored size: 528 Bytes

Contents

require 'eventmachine'

module Enumerable

  # ``You are not expected to understand this. ... The real problem is
  #   that we didn't understand what was going on either.''
  #                                                      Dennis Ritcie
  def each_next_tick
    raise ArgumentError, "no block given" unless block_given?
    nop = lambda do end
    self.reverse_each.inject nop do |block, obj|
      lambda do
        EM.next_tick do
          yield obj
          block.call
        end
      end
    end.call
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tengine_support-1.2.2 lib/tengine/support/core_ext/enumerable/each_next_tick.rb
tengine_support-1.2.1 lib/tengine/support/core_ext/enumerable/each_next_tick.rb
tengine_support-1.2.0 lib/tengine/support/core_ext/enumerable/each_next_tick.rb
tengine_support-1.1.0 lib/tengine/support/core_ext/enumerable/each_next_tick.rb
tengine_support-0.3.27 lib/tengine/support/core_ext/enumerable/each_next_tick.rb
tengine_support-0.3.26 lib/tengine/support/core_ext/enumerable/each_next_tick.rb
tengine_support-0.3.25 lib/tengine/support/core_ext/enumerable/each_next_tick.rb
tengine_support-0.3.24 lib/tengine/support/core_ext/enumerable/each_next_tick.rb