Module: Kernel

Defined in:
lib/asynchronous/kernel.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#async(type = :Concurrency, &block) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/asynchronous/kernel.rb', line 14

def async(type= :Concurrency ,&block)
  type= type.to_s
  case type.downcase[0]
    when "c"
      begin
        Asynchronous::Concurrency.new(block)
      end
    when "p"
      begin
        Asynchronous::Parallelism.new(block)
      end
    else
      nil

  end
end