Let's say you have such method:
def log_yield(sql, args=nil)
sql = "#{sql}; #{args.inspect}" if args
t0 = Time.now
begin
yield
rescue => e
log_exception(e, sql)
raise
ensure
t1 = Time.now
log_duration(Integer((t1-t0)*1000), sql) unless e
end
end
I need to override this method and implement it in similar manner BUT I need to get the block that gets returned by yield
.
(specifically, I need to identify what block generated particular sql in Sequel::Database)