class Object

Public Instance Methods

Threadify(*args, &block) click to toggle source
# File lib/threadify.rb, line 25
def Threadify(*args, &block)
  # setup
  #
    opts = args.last.is_a?(Hash) ? args.pop : {}
    opts.keys.each{|key| opts[key.to_s.to_sym] = opts.delete(key)}
    opts[:threads] ||= (Numeric === args.first ? args.shift : Threadify.threads)
    opts[:strategy] ||= (args.empty? ? Threadify.strategy : args)

    threads = Integer(opts[:threads])

    array_of_blocks = Array.new(threads){ block }
    array_of_blocks.threadify(opts){|b| b.call()}
end
threadify!(*values) click to toggle source
# File lib/threadify.rb, line 150
def threadify!(*values)
  throw :threadify, *values
end