pgtk 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67f6a37e2b367219638c94f962da49b68bcf2f45bd9b149cb721176dc779648a
4
- data.tar.gz: ba3143b581e30891069df7d9ae37c6a4434a52ebe8e8fb4145f10e5dc71c0152
3
+ metadata.gz: 119d9d36d6cb4602525162faaa1651d440a1d6d961e6fd752d98d386654e0040
4
+ data.tar.gz: '079362616ac7e1d6f9c0af0e02d3ed07147efe7b6529795076bd3ab3951fb257'
5
5
  SHA512:
6
- metadata.gz: e1f068ecb03bff93ad645f4ebd1a6050016feaaada9a75693e011bf19148c9fbd8910bcfc5a50f3596f2fa1f0cff77f7db8b606727ca4cc473a7a57d312d2491
7
- data.tar.gz: 617af03e10b63f024686702d90caf9b9bb9e1c2a4ef59ba2e3aa1921dceedb3bcc040bcb18587853a3511831de6accff0c1dde2580f25f2b3bef6734163bbde7
6
+ metadata.gz: 0c5477226ff48e6de9d3eb7a3d56c22710e86bb43376d7f5faae71c6b1706421a2e1c2687a6ec2cca11e17719aa707d2da1519f91ad46885ffad56bffa10d687
7
+ data.tar.gz: 419345b54d9ecf5a495f81c2b7f3b705d8dd64e9c66046c22360acc0dc8bfefbb0c5c5763bca60271258e59c33e11ce2c469628ea53ff2e772bef275d0a548ba
data/lib/pgtk/spy.rb CHANGED
@@ -23,14 +23,15 @@ class Pgtk::Spy
23
23
  end
24
24
 
25
25
  def exec(sql, *args)
26
- @block.call(sql)
27
- @pool.exec(sql, *args)
26
+ start = Time.now
27
+ ret = @pool.exec(sql, *args)
28
+ @block&.call(sql.is_a?(Array) ? sql.join(' ') : sql, Time.now - start)
29
+ ret
28
30
  end
29
31
 
30
32
  def transaction
31
- @block.call('txn')
32
33
  @pool.transaction do |t|
33
- yield Spy.new(t, @block)
34
+ yield Pgtk::Spy.new(t, &@block)
34
35
  end
35
36
  end
36
37
  end
data/lib/pgtk/version.rb CHANGED
@@ -11,5 +11,5 @@ require_relative '../pgtk'
11
11
  # License:: MIT
12
12
  module Pgtk
13
13
  # Current version of the library.
14
- VERSION = '0.13.0'
14
+ VERSION = '0.13.1'
15
15
  end
data/test/test_pool.rb CHANGED
@@ -43,7 +43,7 @@ class TestPool < Minitest::Test
43
43
  bootstrap do |pool|
44
44
  pool = Pgtk::Spy.new(pool) { |sql| queries.append(sql) }
45
45
  pool.exec(
46
- 'INSERT INTO book (title) VALUES ($1)',
46
+ ['INSERT INTO book', '(title) VALUES ($1)'],
47
47
  ['Elegant Objects']
48
48
  )
49
49
  end
@@ -85,7 +85,7 @@ class TestPool < Minitest::Test
85
85
 
86
86
  def test_transaction
87
87
  bootstrap do |pool|
88
- id = pool.transaction do |t|
88
+ id = Pgtk::Spy.new(pool).transaction do |t|
89
89
  t.exec('DELETE FROM book')
90
90
  t.exec(
91
91
  [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko