brick 1.0.167 → 1.0.168

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: dc6c27a0806fb3e263addc8e33b18974c93521c5cf3da264712e0188e3b010e3
4
- data.tar.gz: 2dd3e67605b0a9e6300b13a00ef602bd34c9fd0dd57e4b7049c2d201a9fd5b04
3
+ metadata.gz: 244666e6b15c99925b2d00706654b1bd57a52e318d067bdd47c67113962a4745
4
+ data.tar.gz: 1b5a82fc567786def9d838060b9cdd1c490e5b11f722e15bac8c972a9a3e8f90
5
5
  SHA512:
6
- metadata.gz: 0ba147231b645bf1596997f65b0b084a39e950d9ecc4f516298664366c22c7ab1b521e6b27e57f2c4aec796cd36bc91ef0e49aa382cec14169c940ce626d3c39
7
- data.tar.gz: 8cc67c037362574ff41ed8c2d0a644975c222d3ce9d5b41e813158a3d389e69395f613d994e894ee1c078c1f96205e073b63c65b7e4f5700dee94addb1a24b61
6
+ metadata.gz: be486b872b89de6367a624cc56898e2add0f37f840365a2e0f824a0af1f0e5c6a34d08645c85a4e1d8c143de5389ac324d60631fd01100d06dd0ceda2ff79cc1
7
+ data.tar.gz: f7ddd11bcc08402c9ce8152274a2ee1d6106c539b2751e0d4e9c23c6ee4da1bcc11a0485035cfdf07c5e81f696b11a417266e48c45245b58b976645c13f39c98
@@ -10,6 +10,24 @@ unless ActiveRecord.respond_to?(:version)
10
10
  end
11
11
  end
12
12
 
13
+ # Allow ActiveRecord < 6.0 to work with Ruby 3.1 and later
14
+ if ActiveRecord.version < ::Gem::Version.new('6.0a') && ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('3.1')
15
+ require 'active_record/type'
16
+ ::ActiveRecord::Type.class_exec do
17
+ class << self
18
+ alias _brick_add_modifier add_modifier
19
+ def add_modifier(options, klass, *args)
20
+ kwargs = if args.length > 2 && args.last.is_a?(Hash)
21
+ args.pop
22
+ else
23
+ {}
24
+ end
25
+ _brick_add_modifier(options, klass, **kwargs)
26
+ end
27
+ end
28
+ end
29
+ end
30
+
13
31
  # Allow ActiveRecord < 3.2 to work with Ruby 2.7 and later
14
32
  if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('2.7')
15
33
  if ActiveRecord.version < ::Gem::Version.new('3.2')
@@ -114,34 +132,32 @@ end
114
132
  # file by having the line "require 'brick/compatibility'" to be the last line in that
115
133
  # file.
116
134
  require 'bigdecimal'
117
- if ActiveRecord.version < ::Gem::Version.new('5.0')
118
- if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('2.6')
119
- def BigDecimal.new(*args, **kwargs)
120
- BigDecimal(*args, **kwargs)
121
- end
135
+ if ActiveRecord.version < ::Gem::Version.new('5.0') && ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('2.6')
136
+ def BigDecimal.new(*args, **kwargs)
137
+ BigDecimal(*args, **kwargs)
138
+ end
122
139
 
123
- if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('3.1')
124
- # @@schemes fix for global_id gem < 1.0
125
- URI.class_variable_set(:@@schemes, {}) unless URI.class_variables.include?(:@@schemes)
126
- if Gem::Specification.all_names.find { |g| g.start_with?('puma-') }
127
- require 'rack/handler/puma'
128
- module Rack::Handler::Puma
129
- class << self
130
- alias _brick_run run
131
- def run(app, *args, **options)
132
- options.merge!(args.pop) if args.last.is_a?(Hash)
133
- _brick_run(app, **options)
134
- end
140
+ if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('3.1')
141
+ # @@schemes fix for global_id gem < 1.0
142
+ URI.class_variable_set(:@@schemes, {}) unless URI.class_variables.include?(:@@schemes)
143
+ if Gem::Specification.all_names.find { |g| g.start_with?('puma-') }
144
+ require 'rack/handler/puma'
145
+ module Rack::Handler::Puma
146
+ class << self
147
+ alias _brick_run run
148
+ def run(app, *args, **options)
149
+ options.merge!(args.pop) if args.last.is_a?(Hash)
150
+ _brick_run(app, **options)
135
151
  end
136
152
  end
137
153
  end
154
+ end
138
155
 
139
- require 'json'
140
- if JSON::Parser.method(:initialize).parameters.length < 2 && JSON.method(:parse).arity == -2
141
- JSON.class_exec do
142
- def self.parse(source, opts = {})
143
- ::JSON::Parser.new(source, **opts).parse
144
- end
156
+ require 'json'
157
+ if JSON::Parser.method(:initialize).parameters.length < 2 && JSON.method(:parse).arity == -2
158
+ JSON.class_exec do
159
+ def self.parse(source, opts = {})
160
+ ::JSON::Parser.new(source, **opts).parse
145
161
  end
146
162
  end
147
163
  end
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 167
8
+ TINY = 168
9
9
 
10
10
  # PRE is nil unless it's a pre-release (beta, RC, etc.)
11
11
  PRE = nil
data/lib/brick.rb CHANGED
@@ -1487,6 +1487,21 @@ ActiveSupport.on_load(:active_record) do
1487
1487
  end
1488
1488
  end
1489
1489
 
1490
+ # Allow ActiveRecord < 6.0 to work with Ruby 3.1 and later
1491
+ if ActiveRecord.version < ::Gem::Version.new('6.0a') && ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('3.1')
1492
+ ::ActiveRecord::Relation.class_exec do
1493
+ alias _original_initialize initialize
1494
+ def initialize(klass, *args)
1495
+ kwargs = if args.last.is_a?(Hash)
1496
+ args.pop
1497
+ else
1498
+ {}
1499
+ end
1500
+ _original_initialize(klass, **kwargs)
1501
+ end
1502
+ end
1503
+ end
1504
+
1490
1505
  if ActiveRecord.version < ::Gem::Version.new('6.1.4') &&
1491
1506
  Psych.method(:load).parameters.any? { |param| param.first == :key && param.last == :aliases }
1492
1507
  Psych.class_exec do
@@ -1965,7 +1980,6 @@ if ActiveRecord.version < ::Gem::Version.new('6.0') && ruby_version >= ::Gem::Ve
1965
1980
  admsm.class_exec do
1966
1981
  # redefine #build
1967
1982
  def build(app, **kwargs)
1968
- # puts klass.name
1969
1983
  if args.length > 1 && args.last.is_a?(Hash)
1970
1984
  kwargs.merge!(args.pop)
1971
1985
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brick
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.167
4
+ version: 1.0.168
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorin Thwaits
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-16 00:00:00.000000000 Z
11
+ date: 2023-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord