activerecord-explainer 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e63c897891645df93cbd00ad44dad995b6cf7ee1420c815959eefefcc91a861
4
- data.tar.gz: 3f9578671205fa47e3f3eb7ed12ca61dcfbd67843610c162f87240f8799e2ce1
3
+ metadata.gz: 28d6a376c3f0a1b95d63efafef3a04235da65d4ce681b00c4a4d14a76ec067fb
4
+ data.tar.gz: d9cdbe0d8357f2af7c6800a533313d85109b0c97a264db11178c3aa3c9112d16
5
5
  SHA512:
6
- metadata.gz: b9370f82fdfab38ddfcab8de3464fed927801af45fca0c93ca274cc115212c8abe7afb3f7a7a67aff19a6ec26acd747ba32629c8c7747fa9cb0ba1346bf3c400
7
- data.tar.gz: 47aa0283bf3f5ed443c681dd28085b20b3eb50473751c0fde419cd01ab37490b9680849078dfbaa47bf96f1635e44b8279fe4920a7e2d607b3a84d957f8b5a86
6
+ metadata.gz: 7a7f9e991b8d5dc4c47d9e5f6735422a3fc22f44e98d161d44a91091317b6f7ba913b7cb1836a5abf10d3bb1d36f3f390a56dbeb347d13e2c02126306c696841
7
+ data.tar.gz: 681b6a6a7633416f7dbb58eda761a37c6f4d79f3751ab644cdbb0726fb83c0e73a1db0bb70e8129c783eb40ba677de38d29f35f30b63d359c6dd08bdcf3faa42
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activerecord-explainer (0.1.0)
4
+ activerecord-explainer (0.2.0)
5
5
  activerecord (>= 5.2)
6
6
  activesupport (>= 5.2)
7
7
 
data/README.md CHANGED
@@ -8,7 +8,7 @@ You can check every SQL EXPLAIN from development log, without :hand: executions.
8
8
 
9
9
  It's no configuration, and you can puts SQL EXPLAIN of every queries to logs.
10
10
 
11
- ![](https://github.com/yhirano55/activerecord-explainer/blob/master/images/capture.png?raw=true)
11
+ ![](https://github.com/yhirano55/activerecord-explainer/blob/master/images/v0.2.0.png?raw=true)
12
12
 
13
13
  ## Installation
14
14
 
@@ -1,13 +1,13 @@
1
- require 'active_support/subscriber'
1
+ require 'active_support/log_subscriber'
2
2
 
3
3
  module ActiveRecord
4
4
  module Explainer
5
- class Subscriber < ActiveSupport::Subscriber # :nodoc:
5
+ class Subscriber < ActiveSupport::LogSubscriber # :nodoc:
6
6
  def sql(event)
7
7
  payload = event.payload
8
8
  return if ignore_payload?(payload) || !ActiveRecord::Base.connection.supports_explain?
9
9
 
10
- logger.debug exec_explain(sql: payload[:sql], binds: payload[:binds])
10
+ debug exec_explain(sql: payload[:sql], binds: payload[:binds])
11
11
  end
12
12
 
13
13
  private
@@ -29,7 +29,7 @@ module ActiveRecord
29
29
  end
30
30
  msg << "\n"
31
31
  msg << ActiveRecord::Base.connection.explain(sql, binds)
32
- msg
32
+ color(msg, :yellow)
33
33
  end
34
34
 
35
35
  def render_bind(attr)
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Explainer
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-explainer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshiyuki Hirano
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-04 00:00:00.000000000 Z
11
+ date: 2019-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord