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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ostruct.rb +6 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cd7835b13bb18fa62b7db22bf42fbd57785c07b4a38ccad4a1b4449d2979133
4
- data.tar.gz: b1fb70a803b08bbbaa0e07a12c6e2b0844743e1613a6c083abc4e35dbb005a59
3
+ metadata.gz: 012af2cd126f44caa849cff5dc4ae721494c6cc65226ad2637901f95e23142cb
4
+ data.tar.gz: 21d664abb828274f6ff897ad4a5ff7f9b9d568bebcd4eaf270357491ebed4148
5
5
  SHA512:
6
- metadata.gz: 1258b993e79b8feff50d4f8dfbbb1ce631421ff8ede98505dde0913d373e41dcca6005e543c2920e18849d8e0af641ac7fc215e61d96b578157619e125d1e9a4
7
- data.tar.gz: 6a957da45dfa487e5d3673c44c621972d41a33508d9fc1af83f9b540498f777dba1a658d13f155ba413d36c055ea8c1e15e23dea80b5d8d715eb3178706824af
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.1"
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.1
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-07 00:00:00.000000000 Z
11
+ date: 2021-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler