Sha256: 073526bb6086d2ebd1a088ee0230c0685407f62a9140df457beae60f022bcdb2

Contents?: true

Size: 650 Bytes

Versions: 3

Compression:

Stored size: 650 Bytes

Contents

# kernel method for asyncron calls
# basic version is :
#
# var= async { "ruby Code here" }
# var.value #> "ruby Code here"
#
# or
#
# var = async :parallelism do
#  "some awsome ruby code here!"
# end
#
module Kernel
  def async(type= :Concurrency ,&block)
    case type.to_s.downcase[0]
      # Concurrency / VM / Green
      when "c","v","g"
        begin
          Asynchronous::Concurrency.new(block)
        end
      # Parallelism / OS / Native
      when "p","o","n"
        begin
          Asynchronous::Parallelism.new(block)
        end
      else
        begin
          Asynchronous::Concurrency.new(block)
        end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
asynchronous-2.0.0 lib/asynchronous/kernel.rb
asynchronous-1.0.4 lib/asynchronous/kernel.rb
asynchronous-1.0.3 lib/asynchronous/kernel.rb