ostruct 0.5.1 → 0.5.2
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/ostruct.rb +6 -3
- 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: 012af2cd126f44caa849cff5dc4ae721494c6cc65226ad2637901f95e23142cb
|
4
|
+
data.tar.gz: 21d664abb828274f6ff897ad4a5ff7f9b9d568bebcd4eaf270357491ebed4148
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 501fe10289a94a64f481ce487f2575392f5faaa6edb6815427f3b143574baaebf5026887b88af7a1d867da85298dd692c1cc352f2ae6099fd60466c0644a7809
|
7
|
+
data.tar.gz: d47056c31c89ec72e73fffd52da97f699200fa58202d274af0a4d11239a4d13e61177031349b84907e68946f4600284057402da344036b47f46d7db83a90f61e
|
data/lib/ostruct.rb
CHANGED
@@ -107,7 +107,7 @@
|
|
107
107
|
# For all these reasons, consider not using OpenStruct at all.
|
108
108
|
#
|
109
109
|
class OpenStruct
|
110
|
-
VERSION = "0.5.
|
110
|
+
VERSION = "0.5.2"
|
111
111
|
|
112
112
|
#
|
113
113
|
# Creates a new OpenStruct object. By default, the resulting OpenStruct
|
@@ -221,11 +221,14 @@ class OpenStruct
|
|
221
221
|
#
|
222
222
|
def new_ostruct_member!(name) # :nodoc:
|
223
223
|
unless @table.key?(name) || is_method_protected!(name)
|
224
|
-
getter_proc = Proc.new { @table[name] }
|
225
|
-
setter_proc = Proc.new {|x| @table[name] = x}
|
226
224
|
if defined?(::Ractor)
|
225
|
+
getter_proc = nil.instance_eval{ Proc.new { @table[name] } }
|
226
|
+
setter_proc = nil.instance_eval{ Proc.new {|x| @table[name] = x} }
|
227
227
|
::Ractor.make_shareable(getter_proc)
|
228
228
|
::Ractor.make_shareable(setter_proc)
|
229
|
+
else
|
230
|
+
getter_proc = Proc.new { @table[name] }
|
231
|
+
setter_proc = Proc.new {|x| @table[name] = x}
|
229
232
|
end
|
230
233
|
define_singleton_method!(name, &getter_proc)
|
231
234
|
define_singleton_method!("#{name}=", &setter_proc)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ostruct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc-Andre Lafortune
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|