ostruct 0.4.0 → 0.5.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 +4 -4
- data/Rakefile +1 -1
- data/lib/ostruct.rb +10 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21e6b4898eb983f5662872ec9b061babc748c196756225e561a2606f1be43f92
|
4
|
+
data.tar.gz: ed5975f18423c5db6e0cc0262ce17aa8a625a9488ab8a3a0a556287e71e7881d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1993c5247e4d0aa91ef62d1cdc943eb7e95b18a74abc0c6739c611ee4676c32a792801bb7b5f2f51c9992799863a5a6aeee66ad7ed69dd0f5b5b6ee0e227a2b
|
7
|
+
data.tar.gz: 119f99ac4213fe46116ffba0c142af7cbba91c7b7e7273ff4fd154585df5f31aa2fdc0048fd4dddc8de21e4ab3e95e1214da40fbb2608126a795f83a2162c628
|
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@ end
|
|
17
17
|
|
18
18
|
task :sync_tool do
|
19
19
|
require 'fileutils'
|
20
|
-
FileUtils.cp "../ruby/tool/lib/
|
20
|
+
FileUtils.cp "../ruby/tool/lib/core_assertions.rb", "./test/lib"
|
21
21
|
FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib"
|
22
22
|
FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib"
|
23
23
|
end
|
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.
|
110
|
+
VERSION = "0.5.0"
|
111
111
|
|
112
112
|
#
|
113
113
|
# Creates a new OpenStruct object. By default, the resulting OpenStruct
|
@@ -221,8 +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
|
-
|
225
|
-
|
224
|
+
getter_proc = Proc.new { @table[name] }
|
225
|
+
setter_proc = Proc.new {|x| @table[name] = x}
|
226
|
+
if defined?(::Ractor)
|
227
|
+
::Ractor.make_shareable(getter_proc)
|
228
|
+
::Ractor.make_shareable(setter_proc)
|
229
|
+
end
|
230
|
+
define_singleton_method!(name, &getter_proc)
|
231
|
+
define_singleton_method!("#{name}=", &setter_proc)
|
226
232
|
end
|
227
233
|
end
|
228
234
|
private :new_ostruct_member!
|
@@ -308,7 +314,7 @@ class OpenStruct
|
|
308
314
|
# Finds and returns the object in nested objects
|
309
315
|
# that is specified by +name+ and +identifiers+.
|
310
316
|
# The nested objects may be instances of various classes.
|
311
|
-
# See {Dig Methods}[rdoc-ref:
|
317
|
+
# See {Dig Methods}[rdoc-ref:dig_methods.rdoc].
|
312
318
|
#
|
313
319
|
# Examples:
|
314
320
|
# require "ostruct"
|
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.
|
4
|
+
version: 0.5.0
|
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-
|
11
|
+
date: 2021-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
|
-
rubygems_version: 3.
|
77
|
+
rubygems_version: 3.3.0.dev
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: Class to build custom data structures, similar to a Hash.
|