active_record-comments 0.1.4 → 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: a7c235ecd96360ffe849e102ea9e443693601c17265b95f4ba56e019d55c8195
4
- data.tar.gz: d29960e44dad97dbb5f3503b6a70b2fb9055ac564e55178e1799d20c8fe7fe85
3
+ metadata.gz: 8059c748ce80a85b6afe8229401296ec82288357acd47119b289d3b5a31d50f9
4
+ data.tar.gz: 742ab1f77aa2ff09e4bdb96994549db0690781c070ae1b202a2478331614e5e9
5
5
  SHA512:
6
- metadata.gz: 27559882aded0940775520bc31970113fd1ea5142cf13b355dc2f952f0f67804094118b76d2c8f6cb287b5ee2e816ae5133d67ba1c806cbf8ae8d6b7af644c6a
7
- data.tar.gz: eb95751b2dbb8ad49e74c196e4265b0aec4ad83cafb5c8b493addb50caedda0f17ca91859da43af560dbe50d6b00a94288052a078694dea798bd4d32464d6bdc
6
+ metadata.gz: c0012f4cb152f560e43135435ae1c7be7c2d4b05d6540780fd983aa8fa236518ecbe6d0b81c90157977c1decda1ce17da0e49c1abaae8c3aa2241d08e8037206
7
+ data.tar.gz: 6ca97bd722121bf43fea68b98b58d215ed3af35d2c75ce8dc03a427d3158c3d3a9049b5746e391cdd463e8eed66dd507a4d6d74a2382c31ee4e4c8dc4c49d03f
@@ -1,56 +1,9 @@
1
+ require "active_record/comments/execute_with_comments"
2
+ require "active_record/comments/version"
1
3
  require "active_record"
2
4
 
3
5
  module ActiveRecord
4
6
  module Comments
5
- module ExecuteWithComments
6
- class << self
7
- def included(base)
8
- base.class_eval do
9
- # ActiveRecord 3.2 vs sqlite, maybe others ...
10
- if base.method_defined?(:exec_query)
11
- alias_method :exec_query_without_comment, :exec_query
12
- def exec_query(query, *args, &block)
13
- query = ActiveRecord::Comments.with_comment_sql(query)
14
- exec_query_without_comment(query, *args, &block)
15
- end
16
-
17
- # 99% case
18
- elsif base.method_defined?(:execute)
19
- alias_method :execute_without_comment, :execute
20
- def execute(query, *args, &block)
21
- query = ActiveRecord::Comments.with_comment_sql(query)
22
- execute_without_comment(query, *args, &block)
23
- end
24
- end
25
- end
26
- end
27
-
28
- def install!
29
- if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter
30
- install ActiveRecord::ConnectionAdapters::SQLite3Adapter
31
- end
32
-
33
- if defined? ActiveRecord::ConnectionAdapters::MysqlAdapter
34
- install ActiveRecord::ConnectionAdapters::MysqlAdapter
35
- end
36
-
37
- if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter
38
- install ActiveRecord::ConnectionAdapters::Mysql2Adapter
39
- end
40
-
41
- if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
42
- install ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
43
- end
44
- end
45
-
46
- private
47
-
48
- def install(adapter)
49
- adapter.send(:include, ::ActiveRecord::Comments::ExecuteWithComments)
50
- end
51
- end
52
- end
53
-
54
7
  class << self
55
8
  def comment(comment)
56
9
  current_comments << comment
@@ -0,0 +1,52 @@
1
+ module ActiveRecord
2
+ module Comments
3
+ module ExecuteWithComments
4
+ class << self
5
+ def included(base)
6
+ base.class_eval do
7
+ # ActiveRecord 3.2 vs sqlite, maybe others ...
8
+ if base.method_defined?(:exec_query)
9
+ alias_method :exec_query_without_comment, :exec_query
10
+ def exec_query(query, *args, &block)
11
+ query = ActiveRecord::Comments.with_comment_sql(query)
12
+ exec_query_without_comment(query, *args, &block)
13
+ end
14
+
15
+ # 99% case
16
+ elsif base.method_defined?(:execute)
17
+ alias_method :execute_without_comment, :execute
18
+ def execute(query, *args, &block)
19
+ query = ActiveRecord::Comments.with_comment_sql(query)
20
+ execute_without_comment(query, *args, &block)
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ def install!
27
+ if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter
28
+ install ActiveRecord::ConnectionAdapters::SQLite3Adapter
29
+ end
30
+
31
+ if defined? ActiveRecord::ConnectionAdapters::MysqlAdapter
32
+ install ActiveRecord::ConnectionAdapters::MysqlAdapter
33
+ end
34
+
35
+ if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter
36
+ install ActiveRecord::ConnectionAdapters::Mysql2Adapter
37
+ end
38
+
39
+ if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
40
+ install ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
41
+ end
42
+ end
43
+
44
+ private
45
+
46
+ def install(adapter)
47
+ adapter.send(:include, ::ActiveRecord::Comments::ExecuteWithComments)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,5 @@
1
+ module ActiveRecord
2
+ module Comments
3
+ VERSION = "0.2.0"
4
+ end
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record-comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-25 00:00:00.000000000 Z
11
+ date: 2021-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6'
22
+ version: '6.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '4'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6'
32
+ version: '6.2'
33
33
  description:
34
34
  email: michael@grosser.it
35
35
  executables: []
@@ -38,6 +38,8 @@ extra_rdoc_files: []
38
38
  files:
39
39
  - MIT-LICENSE
40
40
  - lib/active_record/comments.rb
41
+ - lib/active_record/comments/execute_with_comments.rb
42
+ - lib/active_record/comments/version.rb
41
43
  homepage: https://github.com/grosser/active_record-comments
42
44
  licenses:
43
45
  - MIT
@@ -50,14 +52,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
50
52
  requirements:
51
53
  - - ">="
52
54
  - !ruby/object:Gem::Version
53
- version: '2.4'
55
+ version: '2.5'
54
56
  required_rubygems_version: !ruby/object:Gem::Requirement
55
57
  requirements:
56
58
  - - ">="
57
59
  - !ruby/object:Gem::Version
58
60
  version: '0'
59
61
  requirements: []
60
- rubygems_version: 3.0.3
62
+ rubygems_version: 3.1.3
61
63
  signing_key:
62
64
  specification_version: 4
63
65
  summary: Comments for activerecord