pp_sql 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pp_sql.rb +5 -22
  3. data/lib/pp_sql/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a776a1fc9f7bfd110a108d678494e6b49d0dbd7
4
- data.tar.gz: d30b76255d67c11b553ca65c1d03387fc2dd1a12
3
+ metadata.gz: c9bddbbd1dba6cf2d777fe5171befcf71d5bec38
4
+ data.tar.gz: 74a50e07848f14e54ba2e8425830857e8e0388fc
5
5
  SHA512:
6
- metadata.gz: 480e3aabb17b5b051c1e142771743d49df6fafe75b3356571787091e25ab060c64c6b73c6a0fc01e9e21e1b5d650ec721728fd3c0393377d390301167ab51e54
7
- data.tar.gz: 519668285ae4688751c559ffde3e93d6be477f3b3d2d58ecda397900ad230e3e85fa11fbe99ad0d145722a1b8ffcc5a200dc685559c34202c0ea991fdc3d2282
6
+ metadata.gz: 4c632dc75d1a303d136f0cf29c4902ed9188a086d475dfa8d33541c9364fdb53f6e693eae1630eddacda43298edf43db9fb8d3e55b4d3105f21c4fcd0d9152b7
7
+ data.tar.gz: 115c957bf9c2ecc3c8b71226d0d9288c6506ec1fb9bce938d685a0d2b4be485b4e0b79f535266bae1e096393627673e9fcc34833a38be1a5e2ae3c1b9d59650a
data/lib/pp_sql.rb CHANGED
@@ -60,33 +60,16 @@ module PpSql
60
60
  end
61
61
  end
62
62
  end
63
+
63
64
  module LogSubscriberPrettyPrint
64
65
  include Formatter
65
66
  def sql(event)
66
- return unless logger.debug?
67
- self.class.runtime += event.duration
68
-
69
- payload = event.payload
70
-
71
- return if ActiveRecord::LogSubscriber::IGNORE_PAYLOAD_NAMES.include?(payload[:name])
72
-
73
- name = "#{payload[:name]} (#{event.duration.round(1)}ms)"
74
- sql = payload[:sql]
75
- binds = nil
76
-
77
- unless (payload[:binds] || []).empty?
78
- binds = " " + payload[:binds].map do |*args|
79
- method(:render_bind).arity == 1 ? render_bind(args.first) : render_bind(*args)
80
- end.inspect
81
- end
82
-
83
- name = colorize_payload_name(name, payload[:name])
84
- # only this line was rewritten from the AR
85
- sql = color(_sql_formatter.format(sql.dup), sql_color(sql), true)
86
-
87
- debug " #{name} #{sql}#{binds}"
67
+ e= event.dup
68
+ e.payload[:sql] = _sql_formatter.format(e.payload[:sql].dup)
69
+ super e
88
70
  end
89
71
  end
72
+
90
73
  class Railtie < Rails::Railtie
91
74
  initializer "pp_sql.override_to_sql" do
92
75
  ActiveSupport.on_load(:active_record) do
@@ -1,3 +1,3 @@
1
1
  module PpSql
2
- VERSION = '0.2.7'
2
+ VERSION = '0.2.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pp_sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kvokka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-04 00:00:00.000000000 Z
11
+ date: 2017-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails