active_record_extended 3.3.0 → 3.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 978b35d2ba33492c2de59e8d26fbc1f176ae1d8a19046a3e3276e693d3f6195f
4
- data.tar.gz: 7a620d8e05d23252e4631c2a91f3bc62f8d983191631c2438ab98b5d0640e90a
3
+ metadata.gz: b9536d7712c3ce9ae40dd62525b5799ff2848e5ba94092c3f6d3c995ffe5467c
4
+ data.tar.gz: deb23d8497e024312c99a0a24723b7ffba98dc60d9f7027863b3c2901ee0070e
5
5
  SHA512:
6
- metadata.gz: 9c0f2ba4720495e95a53bf8971ce634af1d2eaf88af05faff5328bfcfadfb7f5da61c5e7984e46389b8b495cd5966fcedeaffac1317474042dd7bf67464c3408
7
- data.tar.gz: 94ae654f051a427e745e8e761411df466cd4ed64b7a131d9326fa05d82e06f5ba0daa81dfa83f6a6be9ec252fa08d41d1559b87098616413606ea67444af1f38
6
+ metadata.gz: ff01f56a0b3fad3363809e3e89eac38642990beed9650c72573636581b1f7f8aed2ccefc5c4e74118be402fe180aaf2bdd8f12bd32d03a99fb172afe6aa8293d
7
+ data.tar.gz: f35c78ca01d1280638622f04aa1520999f3fb6f8d2ea1fc3949890b8949d5e644025fc5da97393e68e08dd4076589c9f6271374b06e84ed1bdac7af4a14dbf60
data/README.md CHANGED
@@ -51,13 +51,13 @@ Active Record Extended is essentially providing users with the other half of Pos
51
51
 
52
52
  ## Compatibility
53
53
 
54
- This package is designed align and work with any officially supported Ruby and Rails versions.
54
+ This package is designed to align and work with any officially supported Ruby and Rails versions.
55
55
  - Minimum Ruby Version: 3.1.x **(EOL warning!)**
56
56
  - Minimum Rails Version: 6.1.x **(EOL warning!)**
57
57
  - Minimum Postgres Version: 12.x **(EOL warning!)**
58
- - Latest Ruby supported: 3.3.x
59
- - Latest Rails supported: 7.1.x
60
- - Postgres: 11-current(16) (probably works with most older versions to a certain point)
58
+ - Latest Ruby supported: 3.4.x
59
+ - Latest Rails supported: 8.0.x
60
+ - Postgres: 11-current(18) (probably works with most older versions to a certain point)
61
61
 
62
62
  ## Installation
63
63
 
@@ -560,7 +560,7 @@ As a means for taking complex query logic and transform them into a single or m
560
560
 
561
561
  **Options:**
562
562
  - `as`: [Symbol or String] (defaults to `"results"`): What the column will be aliased to
563
- - `value`: [Symbol or String] (defaults to `key` argument): How the response should handel the json value return
563
+ - `value`: [Symbol or String] (defaults to `key` argument): How the response should handle the json value return
564
564
 
565
565
  See the included example on [Row To JSON](#row-to-json) to see it in action.
566
566
 
@@ -606,7 +606,7 @@ There's an issue with providing a single union clause and chaining it with a dif
606
606
  This is due to requirements of grouping SQL statements. The issue is being working on, but with no ETA.
607
607
 
608
608
  This issue only applies to the first initial set of unions and is recommended that you union two relations right off the bat.
609
- Afterwords you can union/chain single relations.
609
+ Afterwards you can union/chain single relations.
610
610
 
611
611
  Example
612
612
 
@@ -263,7 +263,7 @@ module ActiveRecordExtended
263
263
  # - as: [Symbol or String] (default="results"): What the column will be aliased to
264
264
  #
265
265
  #
266
- # - value: [Symbol or String] (defaults=[key]): How the response should handel the json value return
266
+ # - value: [Symbol or String] (defaults=[key]): How the response should handle the json value return
267
267
  #
268
268
  # Example:
269
269
  #
@@ -3,8 +3,9 @@
3
3
  module ActiveRecordExtended
4
4
  module QueryMethods
5
5
  module Unionize
6
- UNION_RELATION_METHODS = [:order_union, :reorder_union, :union_as].freeze
7
- UNIONIZE_METHODS = [:union, :union_all, :union_except, :union_intersect].freeze
6
+ UNION_RELATION_METHODS = [:order_union, :reorder_union, :union_as].freeze
7
+ UNIONIZE_METHODS = [:union, :union_all, :union_except, :union_intersect].freeze
8
+ DEFAULT_STORAGE_VALUE = proc { [] }
8
9
 
9
10
  class UnionChain
10
11
  include ActiveRecordExtended::Utilities::Support
@@ -86,15 +87,17 @@ module ActiveRecordExtended
86
87
  end
87
88
 
88
89
  {
89
- union_values: Array,
90
- union_operations: Array,
91
- union_ordering_values: Array,
92
- unionized_name: lambda { |klass| klass.arel_table.name }
90
+ union_values: DEFAULT_STORAGE_VALUE,
91
+ union_operations: DEFAULT_STORAGE_VALUE,
92
+ union_ordering_values: DEFAULT_STORAGE_VALUE,
93
+ unionized_name: proc { arel_table.name }
93
94
  }.each_pair do |method_name, default|
94
95
  define_method(method_name) do
95
- return unionize_storage[method_name] if send(:"#{method_name}?")
96
-
97
- (default.is_a?(Proc) ? default.call(@klass) : default.new)
96
+ if send(:"#{method_name}?")
97
+ unionize_storage[method_name]
98
+ else
99
+ instance_eval(&default)
100
+ end
98
101
  end
99
102
 
100
103
  define_method(:"#{method_name}?") do
@@ -141,7 +144,7 @@ module ActiveRecordExtended
141
144
 
142
145
  protected
143
146
 
144
- def build_unions(arel = @klass.arel_table)
147
+ def build_unions(arel)
145
148
  return unless union_values?
146
149
 
147
150
  union_nodes = apply_union_ordering(build_union_nodes!)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordExtended
4
- VERSION = "3.3.0"
4
+ VERSION = "3.4.0"
5
5
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "active_record_extended/version"
4
4
 
5
+ require "logger"
5
6
  require "active_record"
6
7
  require "active_record/relation"
7
8
  require "active_record/relation/merger"
@@ -10,7 +11,7 @@ require "active_record/relation/query_methods"
10
11
  module ActiveRecordExtended
11
12
  extend ActiveSupport::Autoload
12
13
 
13
- AR_VERSION_GTE_6_1 = Gem::Requirement.new(">= 6.1").satisfied_by?(ActiveRecord.gem_version)
14
+ AR_VERSION_GTE_8_0 = Gem::Requirement.new(">= 8.0").satisfied_by?(ActiveRecord.gem_version)
14
15
 
15
16
  module Utilities
16
17
  extend ActiveSupport::Autoload
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_extended
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Protacio-Karaszi
8
8
  - Dan McClain
9
9
  - Olivier El Mekki
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2024-07-22 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: activerecord
@@ -21,7 +20,7 @@ dependencies:
21
20
  version: '5.2'
22
21
  - - "<"
23
22
  - !ruby/object:Gem::Version
24
- version: 8.0.0
23
+ version: '8.1'
25
24
  type: :runtime
26
25
  prerelease: false
27
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -31,7 +30,7 @@ dependencies:
31
30
  version: '5.2'
32
31
  - - "<"
33
32
  - !ruby/object:Gem::Version
34
- version: 8.0.0
33
+ version: '8.1'
35
34
  - !ruby/object:Gem::Dependency
36
35
  name: pg
37
36
  requirement: !ruby/object:Gem::Requirement
@@ -83,7 +82,6 @@ licenses:
83
82
  - MIT
84
83
  metadata:
85
84
  rubygems_mfa_required: 'true'
86
- post_install_message:
87
85
  rdoc_options: []
88
86
  require_paths:
89
87
  - lib
@@ -98,8 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
96
  - !ruby/object:Gem::Version
99
97
  version: '0'
100
98
  requirements: []
101
- rubygems_version: 3.5.11
102
- signing_key:
99
+ rubygems_version: 3.7.2
103
100
  specification_version: 4
104
101
  summary: Adds extended functionality to Activerecord Postgres implementation
105
102
  test_files: []