pp_sql 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/pp_sql/version.rb +1 -1
- data/lib/pp_sql.rb +7 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0484e8514ae3f6ea42b32b9891fe018a0e250ca
|
4
|
+
data.tar.gz: 97c7be78e3630605b9b4f641bf18d2af339c5635
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0602428428646d37ffca24f6376d4b859ba1fa17d226cbcfa907aac39aa5a006f4d1228615090ad59836f307955fd5a9d07f212399a011cf577942e12aad3a16'
|
7
|
+
data.tar.gz: 77f18a621dfa277039757c39d0fa822175d995d385cccd85db67351380b10ce84a3311c548d96312d93db03fe9969ab31d66c039359d5f8da24bde1b62e8eb23
|
data/README.md
CHANGED
@@ -42,7 +42,11 @@ $ bundle
|
|
42
42
|
## With other formatters
|
43
43
|
|
44
44
|
If you are `pry` user, or use custom output formatter, use `puts` for output whitespaces,
|
45
|
-
like `puts User.all.to_sql`, or use `User.all.pp_sql
|
45
|
+
like `puts User.all.to_sql`, or use `User.all.pp_sql`.
|
46
|
+
|
47
|
+
## With Rails
|
48
|
+
|
49
|
+
If you do not want to rewrite default `#to_sql` method you may specify `PpSql.rewrite_to_sql_method=false` in initializers.
|
46
50
|
|
47
51
|
## License
|
48
52
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/lib/pp_sql/version.rb
CHANGED
data/lib/pp_sql.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
module PpSql
|
2
|
+
# class << self
|
3
|
+
# if you do not want to rewrite AR native method #to_sql
|
4
|
+
# you may switch this setting to false in initializer
|
5
|
+
mattr_accessor :rewrite_to_sql_method
|
6
|
+
self.rewrite_to_sql_method = true
|
7
|
+
# end
|
2
8
|
module Formatter
|
3
9
|
private
|
4
10
|
|
@@ -15,6 +21,7 @@ module PpSql
|
|
15
21
|
module ToSqlBeautify
|
16
22
|
include Formatter
|
17
23
|
def to_sql
|
24
|
+
return super unless ::PpSql.rewrite_to_sql
|
18
25
|
_sql_formatter.format(defined?(super) ? super.dup : self)
|
19
26
|
end
|
20
27
|
|
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.6
|
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-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.5.
|
73
|
+
rubygems_version: 2.5.2
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: Beautify SQL output of ActiveRecord#to_sql
|