activerecord-originator 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Rakefile +25 -0
- data/lib/activerecord/originator/arel_visitor_extension.rb +10 -8
- data/lib/activerecord/originator/version.rb +1 -1
- data/lib/activerecord/originator.rb +7 -1
- data/rbs_collection.lock.yaml +6 -6
- data/rbs_collection.yaml +0 -5
- data/sig/_polyfill/rails.rbs +3 -0
- data/sig/activerecord/originator/arel_visitor_extension.rbs +1 -0
- data/sig/{polyfill.rbs → interfaces.rbs} +0 -4
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 293717934922e2684e5351b8f2c1abe48bb72f13706a3c3453496e92b501dd18
|
4
|
+
data.tar.gz: 0c445a63206b42a5742727875d51bb95385e48d086d637966b784397d9acc6ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aada6e56b8c43b7f0fe9c6520ffedbb6c9cb099e817815cbc48a67b7473903cbb8cf9cb0fe899354d7de1f5808ee81d315b8b7e5b976989270dc0e3b97ddbce
|
7
|
+
data.tar.gz: 896311b48db01c18309b3d7d22c41b4dda6385c81cba5ff47fb3e568f6a569d82ff2d6fced94fe6a6996a688eef271a784008500e3ff183f020246b9783497c4
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## v0.2.1 - 2024-03-20
|
4
|
+
|
5
|
+
This release does not affect the behavior of the library. It changes only RBS files.
|
6
|
+
|
7
|
+
* Avoid exposing Rails.backtrace_cleaner type [#19](https://github.com/pocke/activerecord-originator/pull/19)
|
8
|
+
|
9
|
+
## v0.2.0 - 2024-03-16
|
10
|
+
|
11
|
+
* Avoid modifying unnecessary nodes for performance. [#15](https://github.com/pocke/activerecord-originator/pull/15)
|
12
|
+
|
13
|
+
## v0.1.0 - 2024-03-13
|
14
|
+
|
15
|
+
* The first release!
|
data/Rakefile
CHANGED
@@ -14,3 +14,28 @@ task :steep do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
task default: %i[rubocop steep spec]
|
17
|
+
|
18
|
+
namespace :benchmark do
|
19
|
+
task :to_sql do
|
20
|
+
puts "# Benchmarking #to_sql mehtod"
|
21
|
+
puts
|
22
|
+
puts "## Wihtout AR::Originator"
|
23
|
+
sh 'ruby', 'benchmark/to_sql.rb'
|
24
|
+
|
25
|
+
puts
|
26
|
+
puts "## With AR::Originator"
|
27
|
+
sh 'ruby', '-r', 'activerecord/originator', 'benchmark/to_sql.rb'
|
28
|
+
end
|
29
|
+
|
30
|
+
task :select_query do
|
31
|
+
puts "# Benchmarking SELECT Query"
|
32
|
+
puts
|
33
|
+
puts "## Wihtout AR::Originator"
|
34
|
+
sh 'ruby', 'benchmark/select_query.rb'
|
35
|
+
|
36
|
+
puts
|
37
|
+
puts "## With AR::Originator"
|
38
|
+
sh 'ruby', '-r', 'activerecord/originator', 'benchmark/select_query.rb'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
task benchmark: %i[benchmark:to_sql benchmark:select_query]
|
@@ -3,13 +3,7 @@
|
|
3
3
|
module ActiveRecord
|
4
4
|
module Originator
|
5
5
|
module ArelVisitorExtension
|
6
|
-
|
7
|
-
super(object, CollectorProxy.new(collector))
|
8
|
-
end
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
%i[
|
6
|
+
TARGET_NODE_CLASSESS = %i[
|
13
7
|
Ascending
|
14
8
|
Descending
|
15
9
|
Equality
|
@@ -21,7 +15,15 @@ module ActiveRecord
|
|
21
15
|
LessThan
|
22
16
|
LessThanOrEqual
|
23
17
|
GreaterThanOrEqual
|
24
|
-
]
|
18
|
+
]
|
19
|
+
|
20
|
+
def accept(object, collector)
|
21
|
+
super(object, CollectorProxy.new(collector))
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
TARGET_NODE_CLASSESS.each do |klass_name|
|
25
27
|
define_method(:"visit_Arel_Nodes_#{klass_name}") do |o, collector|
|
26
28
|
__skip__ = begin
|
27
29
|
comment = originator_comment(o)
|
@@ -10,7 +10,13 @@ require_relative "originator/arel_node_extension"
|
|
10
10
|
require_relative "originator/arel_visitor_extension"
|
11
11
|
require_relative "originator/collector_proxy"
|
12
12
|
|
13
|
-
|
13
|
+
ActiveRecord::Originator::ArelVisitorExtension::TARGET_NODE_CLASSESS.each do |name|
|
14
|
+
begin
|
15
|
+
klass = Arel::Nodes.const_get(name)
|
16
|
+
rescue NameError
|
17
|
+
# Some classes are not defined in old arel
|
18
|
+
next
|
19
|
+
end
|
14
20
|
klass.prepend ActiveRecord::Originator::ArelNodeExtension
|
15
21
|
end
|
16
22
|
Arel::Visitors::ToSql.prepend ActiveRecord::Originator::ArelVisitorExtension
|
data/rbs_collection.lock.yaml
CHANGED
@@ -6,7 +6,7 @@ gems:
|
|
6
6
|
source:
|
7
7
|
type: git
|
8
8
|
name: ruby/gem_rbs_collection
|
9
|
-
revision:
|
9
|
+
revision: be76a75932e8ed6ee91a95ba936cf88b674bf044
|
10
10
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
11
11
|
repo_dir: gems
|
12
12
|
- name: activerecord
|
@@ -14,7 +14,7 @@ gems:
|
|
14
14
|
source:
|
15
15
|
type: git
|
16
16
|
name: ruby/gem_rbs_collection
|
17
|
-
revision:
|
17
|
+
revision: be76a75932e8ed6ee91a95ba936cf88b674bf044
|
18
18
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
19
19
|
repo_dir: gems
|
20
20
|
- name: activesupport
|
@@ -22,7 +22,7 @@ gems:
|
|
22
22
|
source:
|
23
23
|
type: git
|
24
24
|
name: ruby/gem_rbs_collection
|
25
|
-
revision:
|
25
|
+
revision: be76a75932e8ed6ee91a95ba936cf88b674bf044
|
26
26
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
27
27
|
repo_dir: gems
|
28
28
|
- name: base64
|
@@ -38,7 +38,7 @@ gems:
|
|
38
38
|
source:
|
39
39
|
type: git
|
40
40
|
name: ruby/gem_rbs_collection
|
41
|
-
revision:
|
41
|
+
revision: be76a75932e8ed6ee91a95ba936cf88b674bf044
|
42
42
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
43
43
|
repo_dir: gems
|
44
44
|
- name: connection_pool
|
@@ -46,7 +46,7 @@ gems:
|
|
46
46
|
source:
|
47
47
|
type: git
|
48
48
|
name: ruby/gem_rbs_collection
|
49
|
-
revision:
|
49
|
+
revision: be76a75932e8ed6ee91a95ba936cf88b674bf044
|
50
50
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
51
51
|
repo_dir: gems
|
52
52
|
- name: date
|
@@ -62,7 +62,7 @@ gems:
|
|
62
62
|
source:
|
63
63
|
type: git
|
64
64
|
name: ruby/gem_rbs_collection
|
65
|
-
revision:
|
65
|
+
revision: be76a75932e8ed6ee91a95ba936cf88b674bf044
|
66
66
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
67
67
|
repo_dir: gems
|
68
68
|
- name: logger
|
data/rbs_collection.yaml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-originator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masataka Pocke Kuwabara
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -48,6 +48,7 @@ extra_rdoc_files: []
|
|
48
48
|
files:
|
49
49
|
- ".rspec"
|
50
50
|
- ".rubocop.yml"
|
51
|
+
- CHANGELOG.md
|
51
52
|
- LICENSE
|
52
53
|
- README.md
|
53
54
|
- Rakefile
|
@@ -60,12 +61,13 @@ files:
|
|
60
61
|
- lib/activerecord/originator/version.rb
|
61
62
|
- rbs_collection.lock.yaml
|
62
63
|
- rbs_collection.yaml
|
64
|
+
- sig/_polyfill/rails.rbs
|
63
65
|
- sig/activerecord/originator.rbs
|
64
66
|
- sig/activerecord/originator/arel_node_extension.rbs
|
65
67
|
- sig/activerecord/originator/arel_visitor_extension.rbs
|
66
68
|
- sig/activerecord/originator/collector_proxy.rbs
|
67
69
|
- sig/activerecord/originator/version.rbs
|
68
|
-
- sig/
|
70
|
+
- sig/interfaces.rbs
|
69
71
|
homepage: https://github.com/pocke/activerecord-originator
|
70
72
|
licenses:
|
71
73
|
- MIT
|