Exception: ArgumentError

Inherits:
Exception
  • Object
show all
Defined in:
lib/parallelpipes.rb

Overview

class IO

def non_blocking_gets(timeout=0.01) t = Thread.ppipe_new= Thread.current; th = nil; th = gets sleep timeout; t.kill; return t end end

Class Method Summary collapse

Class Method Details

.check(*values, &block) ⇒ Object



334
335
336
337
338
339
340
341
342
343
# File 'lib/parallelpipes.rb', line 334

def self.check(*values, &block)
	values.each do |name, value, test_data|
		if block
			raise new("#{name} failed argument correctness test (value given was '#{value.inspect}')") unless yield(value, test_data)
		else
			is_array = test_data.class == Array
			raise new("#{name} was of class #{value.class} instead of #{test_data.inspect} (value given was #{value.inspect})") unless (is_array ? test_data.include?(value.class) : value.class == test_data)
		end
	end
end