lib/knj/thread2.rb in knjrbfw-0.0.7 vs lib/knj/thread2.rb in knjrbfw-0.0.8
- old
+ new
@@ -4,16 +4,16 @@
@block = block if block_given?
@callbacks = {}
end
def connect(signal, &block)
- @callbacks[signal] = [] if !@callbacks.has_key?(signal)
+ @callbacks[signal] = [] if !@callbacks.key?(signal)
@callbacks[signal] << block
end
def call(signal, *args)
- return false if !@callbacks.has_key?(signal)
+ return false if !@callbacks.key?(signal)
@callbacks[signal].each do |block|
block.call(*args)
end
return {:count => count}
@@ -30,10 +30,10 @@
call(:on_exit)
exit
rescue Exception => e
call(:on_error, e)
- if !@args.has_key?(:print_error) or @args[:print_error]
+ if !@args.key?(:print_error) or @args[:print_error]
print "Error: "
puts e.inspect
print "\n"
puts e.backtrace
print "\n\n"
\ No newline at end of file