brick 1.0.166 → 1.0.168
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brick/compatibility.rb +39 -23
- data/lib/brick/frameworks/rails/form_tags.rb +3 -3
- data/lib/brick/version_number.rb +1 -1
- data/lib/brick.rb +15 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 244666e6b15c99925b2d00706654b1bd57a52e318d067bdd47c67113962a4745
|
4
|
+
data.tar.gz: 1b5a82fc567786def9d838060b9cdd1c490e5b11f722e15bac8c972a9a3e8f90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be486b872b89de6367a624cc56898e2add0f37f840365a2e0f824a0af1f0e5c6a34d08645c85a4e1d8c143de5389ac324d60631fd01100d06dd0ceda2ff79cc1
|
7
|
+
data.tar.gz: f7ddd11bcc08402c9ce8152274a2ee1d6106c539b2751e0d4e9c23c6ee4da1bcc11a0485035cfdf07c5e81f696b11a417266e48c45245b58b976645c13f39c98
|
data/lib/brick/compatibility.rb
CHANGED
@@ -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
|
-
|
119
|
-
|
120
|
-
|
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
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
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
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
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
|
@@ -66,7 +66,7 @@ module Brick::Rails::FormTags
|
|
66
66
|
s << " title=\"#{col.comment}\"" if col.respond_to?(:comment) && !col.comment.blank?
|
67
67
|
s << if (bt = bts[col_name])
|
68
68
|
# Allow sorting for any BT except polymorphics
|
69
|
-
x_order = " x-order=\"#{bt.first
|
69
|
+
x_order = " x-order=\"#{bt.first}\"" unless bt[2]
|
70
70
|
"#{x_order}>BT #{bt[1].map { |bt_pair| bt_pair.first.bt_link(bt.first) }.join(' ')}"
|
71
71
|
else # Normal column
|
72
72
|
col_name_humanised = klass.human_attribute_name(col_name, { default: col_name })
|
@@ -83,11 +83,11 @@ module Brick::Rails::FormTags
|
|
83
83
|
x_order = " x-order=\"#{col_name}\"" if true
|
84
84
|
s << "#{x_order}>#{col_name}"
|
85
85
|
elsif col_name.is_a?(Symbol) && (hot = bts[col_name]) # has_one :through
|
86
|
-
x_order = " x-order=\"#{hot.first
|
86
|
+
x_order = " x-order=\"#{hot.first}\"" if true
|
87
87
|
s << "#{x_order}>HOT " +
|
88
88
|
hot[1].map { |hot_pair| hot_pair.first.bt_link(col_name) }.join(' ')
|
89
89
|
elsif (bt = composite_bt_names[col_name])
|
90
|
-
x_order = " x-order=\"#{bt.first
|
90
|
+
x_order = " x-order=\"#{bt.first}\"" unless bt[2]
|
91
91
|
s << "#{x_order}>BT comp " +
|
92
92
|
bt[1].map { |bt_pair| bt_pair.first.bt_link(bt.first) }.join(' ')
|
93
93
|
else # Bad column name!
|
data/lib/brick/version_number.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2023-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|