yiffspace 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/yiffspace/core_ext/active_record/all.rb +5 -0
- data/lib/yiffspace/core_ext/active_record/cross_join_lateral.rb +7 -0
- data/lib/yiffspace/core_ext/active_record/cross_unnest.rb +7 -0
- data/lib/yiffspace/core_ext/active_record/left_join_lateral.rb +7 -0
- data/lib/yiffspace/core_ext/active_record/left_unnest.rb +7 -0
- data/lib/yiffspace/core_ext/active_record/unnest.rb +8 -0
- data/lib/yiffspace/extensions/active_record/cross_join_lateral.rb +23 -0
- data/lib/yiffspace/extensions/active_record/cross_unnest.rb +15 -0
- data/lib/yiffspace/extensions/active_record/left_join_lateral.rb +24 -0
- data/lib/yiffspace/extensions/active_record/left_unnest.rb +15 -0
- data/lib/yiffspace/extensions/active_record/unnest.rb +20 -0
- data/lib/yiffspace/utils/table_builder.rb +6 -2
- data/lib/yiffspace/version.rb +1 -1
- metadata +14 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cefef031ead65141131e7f72f00e5566ff583af3f75aa206582c2995d6049ddb
|
|
4
|
+
data.tar.gz: 152bd5da392923c16cb846e7a0baea169ac376e2934d36ad2edbfc1f0ed74bcd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4936d1d24877c51abd5b9a7d3e2e9328732444ff662cca0b02ee77bf241be82522148ccc617b933186fbe40f0b1b0eaaf47cdfa75a57587b09ffcf3a6f763df7
|
|
7
|
+
data.tar.gz: 0f83b7762c858159b2ede8ec942210b7cca5a6b3b9a2d1da0cd4dff885df9007588b0e3c9a4641aa53b0c9af70d6178983fecf8d195b072b783ecff4b2408d5d
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require("active_record/relation")
|
|
4
|
+
require_relative("../arel/cross_join_lateral")
|
|
5
|
+
require_relative("../../extensions/active_record/cross_join_lateral")
|
|
6
|
+
|
|
7
|
+
ActiveRecord::Relation.include(YiffSpace::Extensions::ActiveRecord::CrossJoinLateral)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require("active_record/relation")
|
|
4
|
+
require_relative("../arel/left_join_lateral")
|
|
5
|
+
require_relative("../../extensions/active_record/left_join_lateral")
|
|
6
|
+
|
|
7
|
+
ActiveRecord::Relation.include(YiffSpace::Extensions::ActiveRecord::LeftJoinLateral)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require("active_record/relation")
|
|
4
|
+
require_relative("cross_join_lateral")
|
|
5
|
+
require_relative("left_join_lateral")
|
|
6
|
+
require_relative("../../extensions/active_record/unnest")
|
|
7
|
+
|
|
8
|
+
ActiveRecord::Relation.include(YiffSpace::Extensions::ActiveRecord::Unnest)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module YiffSpace
|
|
4
|
+
module Extensions
|
|
5
|
+
module ActiveRecord
|
|
6
|
+
module CrossJoinLateral
|
|
7
|
+
def cross_join_lateral(relation)
|
|
8
|
+
raise(ArgumentError, "The method .cross_join_lateral() must contain arguments.") if relation.nil?
|
|
9
|
+
|
|
10
|
+
relation = relation.arel if relation.respond_to?(:arel)
|
|
11
|
+
spawn.cross_join_lateral!(relation)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def cross_join_lateral!(relation) # :nodoc:
|
|
15
|
+
manager = klass.arel_table.cross_join_lateral(relation)
|
|
16
|
+
|
|
17
|
+
self.joins_values |= [manager.join_sources.first]
|
|
18
|
+
self
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module YiffSpace
|
|
4
|
+
module Extensions
|
|
5
|
+
module ActiveRecord
|
|
6
|
+
module CrossUnnest
|
|
7
|
+
def cross_unnest(column, as: column.singularize)
|
|
8
|
+
raise(ArgumentError, "The method .cross_unnest() must contain arguments.") if column.nil?
|
|
9
|
+
|
|
10
|
+
spawn.unnest(column, as: as, type: :cross_join_lateral)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module YiffSpace
|
|
4
|
+
module Extensions
|
|
5
|
+
module ActiveRecord
|
|
6
|
+
module LeftJoinLateral
|
|
7
|
+
def left_join_lateral(relation, on: nil)
|
|
8
|
+
raise(ArgumentError, "The method .left_join_lateral() must contain arguments.") if relation.nil?
|
|
9
|
+
|
|
10
|
+
relation = relation.arel if relation.respond_to?(:arel)
|
|
11
|
+
spawn.left_join_lateral!(relation, on: on)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def left_join_lateral!(relation, on: nil) # :nodoc:
|
|
15
|
+
manager = klass.arel_table.left_join_lateral(relation)
|
|
16
|
+
manager.on(on) if on
|
|
17
|
+
|
|
18
|
+
self.joins_values |= [manager.join_sources.first]
|
|
19
|
+
self
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module YiffSpace
|
|
4
|
+
module Extensions
|
|
5
|
+
module ActiveRecord
|
|
6
|
+
module LeftUnnest
|
|
7
|
+
def left_unnest(column, as: column.singularize)
|
|
8
|
+
raise(ArgumentError, "The method .left_unnest() must contain arguments.") if column.nil?
|
|
9
|
+
|
|
10
|
+
spawn.unnest(column, as: as, type: :left_join_lateral)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module YiffSpace
|
|
4
|
+
module Extensions
|
|
5
|
+
module ActiveRecord
|
|
6
|
+
module Unnest
|
|
7
|
+
def unnest(column, as: column.singularize, type: :left_join_lateral)
|
|
8
|
+
raise(ArgumentError, "The method .unnest() must contain arguments.") if column.nil?
|
|
9
|
+
|
|
10
|
+
spawn.unnest!(column, as, type)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def unnest!(column, name, type) # :nodoc:
|
|
14
|
+
function = ::Arel::Nodes::NamedFunction.new("unnest", [klass.arel_table[column]]).as(name)
|
|
15
|
+
spawn.send("#{type}!", function, **({ on: ::Arel.sql("TRUE") } if type == :left_join_lateral))
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -65,8 +65,12 @@ module YiffSpace
|
|
|
65
65
|
# @return [#to_s] the value of the table cell
|
|
66
66
|
def value(item, row, column)
|
|
67
67
|
if block.present?
|
|
68
|
-
block.
|
|
69
|
-
|
|
68
|
+
view = block.binding.receiver
|
|
69
|
+
if view.respond_to?(:capture)
|
|
70
|
+
view.capture { block.call(item, row, column, self) }
|
|
71
|
+
else
|
|
72
|
+
block.call(item, row, column, self)
|
|
73
|
+
end
|
|
70
74
|
elsif attribute.is_a?(Symbol)
|
|
71
75
|
item.send(attribute)
|
|
72
76
|
else
|
data/lib/yiffspace/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yiffspace
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Donovan_DMC
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-08-
|
|
10
|
+
date: 2026-08-21 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: abbrev
|
|
@@ -43,14 +43,14 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '
|
|
46
|
+
version: '8.1'
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
53
|
+
version: '8.1'
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: request_store
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -114,6 +114,11 @@ files:
|
|
|
114
114
|
- lib/yiffspace/configuration.rb
|
|
115
115
|
- lib/yiffspace/configuration/images.rb
|
|
116
116
|
- lib/yiffspace/core_ext/active_record/all.rb
|
|
117
|
+
- lib/yiffspace/core_ext/active_record/cross_join_lateral.rb
|
|
118
|
+
- lib/yiffspace/core_ext/active_record/cross_unnest.rb
|
|
119
|
+
- lib/yiffspace/core_ext/active_record/left_join_lateral.rb
|
|
120
|
+
- lib/yiffspace/core_ext/active_record/left_unnest.rb
|
|
121
|
+
- lib/yiffspace/core_ext/active_record/unnest.rb
|
|
117
122
|
- lib/yiffspace/core_ext/active_record/where_chain.rb
|
|
118
123
|
- lib/yiffspace/core_ext/all.rb
|
|
119
124
|
- lib/yiffspace/core_ext/arel/all.rb
|
|
@@ -129,6 +134,11 @@ files:
|
|
|
129
134
|
- lib/yiffspace/core_ext/string/all.rb
|
|
130
135
|
- lib/yiffspace/core_ext/string/sql.rb
|
|
131
136
|
- lib/yiffspace/engine.rb
|
|
137
|
+
- lib/yiffspace/extensions/active_record/cross_join_lateral.rb
|
|
138
|
+
- lib/yiffspace/extensions/active_record/cross_unnest.rb
|
|
139
|
+
- lib/yiffspace/extensions/active_record/left_join_lateral.rb
|
|
140
|
+
- lib/yiffspace/extensions/active_record/left_unnest.rb
|
|
141
|
+
- lib/yiffspace/extensions/active_record/unnest.rb
|
|
132
142
|
- lib/yiffspace/extensions/active_record/where_chain.rb
|
|
133
143
|
- lib/yiffspace/extensions/arel/nodes/cross_join_lateral.rb
|
|
134
144
|
- lib/yiffspace/extensions/arel/nodes/left_join_lateral.rb
|