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.
- checksums.yaml +4 -4
- data/lib/pp_sql.rb +5 -22
- data/lib/pp_sql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9bddbbd1dba6cf2d777fe5171befcf71d5bec38
|
4
|
+
data.tar.gz: 74a50e07848f14e54ba2e8425830857e8e0388fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
67
|
-
|
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
|
data/lib/pp_sql/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|