lib/knj/knjdb/query_buffer.rb in knjrbfw-0.0.101 vs lib/knj/knjdb/query_buffer.rb in knjrbfw-0.0.102
- old
+ new
@@ -9,14 +9,16 @@
@debug = @args[:debug]
@lock = Mutex.new
STDOUT.puts "Query buffer started." if @debug
- begin
- yield(self)
- ensure
- self.flush
- end
+ if block_given?
+ begin
+ yield(self)
+ ensure
+ self.flush
+ end
+ end
end
#Adds a query to the buffer.
def query(str)
@lock.synchronize do
\ No newline at end of file