oj_windows 3.16.15 → 3.17.2.1
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/CHANGELOG.md +73 -0
- data/README.md +168 -164
- data/ext/oj_windows/extconf.rb +11 -5
- data/ext/oj_windows/mem.c +31 -17
- data/ext/oj_windows/oj.h +6 -0
- data/ext/oj_windows/parse.c +49 -1
- data/ext/oj_windows/parser.c +79 -10
- data/ext/oj_windows/reader.c +2 -0
- data/ext/oj_windows/rxclass.c +1 -1
- data/ext/oj_windows/safe.c +230 -0
- data/ext/oj_windows/safe.h +79 -0
- data/ext/oj_windows/simd.h +46 -0
- data/ext/oj_windows/sparse.c +3 -0
- data/ext/oj_windows/usual.c +4 -1
- data/lib/oj_windows/version.rb +4 -4
- data/pages/InstallOptions.md +14 -4
- metadata +12 -15
- data/lib/oj/active_support_helper.rb +0 -39
- data/lib/oj/bag.rb +0 -95
- data/lib/oj/easy_hash.rb +0 -52
- data/lib/oj/error.rb +0 -21
- data/lib/oj/json.rb +0 -188
- data/lib/oj/mimic.rb +0 -301
- data/lib/oj/saj.rb +0 -80
- data/lib/oj/schandler.rb +0 -143
- data/lib/oj/state.rb +0 -135
- data/lib/oj/version.rb +0 -4
metadata
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: oj_windows
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.17.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
+
- Peter Ohler
|
|
7
8
|
- tigel
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
@@ -85,9 +86,13 @@ dependencies:
|
|
|
85
86
|
- - "~>"
|
|
86
87
|
- !ruby/object:Gem::Version
|
|
87
88
|
version: '3.0'
|
|
88
|
-
description: oj_windows is a
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
description: 'oj_windows is a fork of Oj (https://github.com/ohler55/oj) by Peter
|
|
90
|
+
Ohler, adapted to build with the MSVC (mswin) Ruby toolchain: pthread mutexes replaced
|
|
91
|
+
with Windows primitives, POSIX headers guarded, and SIMD string scanning enabled
|
|
92
|
+
under MSVC. It provides the full Oj API (module Oj) and JSON-gem compatibility.
|
|
93
|
+
Because it defines the same Oj module, it is a replacement for - and cannot be installed
|
|
94
|
+
alongside - the upstream oj gem. Requires Ruby 3.4+ built with the MSVC toolchain
|
|
95
|
+
(RubyInstaller/MinGW users should use the upstream oj gem instead).'
|
|
91
96
|
email: tigel-agm@tigel.com
|
|
92
97
|
executables: []
|
|
93
98
|
extensions:
|
|
@@ -157,6 +162,8 @@ files:
|
|
|
157
162
|
- ext/oj_windows/resolve.h
|
|
158
163
|
- ext/oj_windows/rxclass.c
|
|
159
164
|
- ext/oj_windows/rxclass.h
|
|
165
|
+
- ext/oj_windows/safe.c
|
|
166
|
+
- ext/oj_windows/safe.h
|
|
160
167
|
- ext/oj_windows/saj.c
|
|
161
168
|
- ext/oj_windows/saj2.c
|
|
162
169
|
- ext/oj_windows/saj2.h
|
|
@@ -176,16 +183,6 @@ files:
|
|
|
176
183
|
- ext/oj_windows/val_stack.h
|
|
177
184
|
- ext/oj_windows/validate.c
|
|
178
185
|
- ext/oj_windows/wab.c
|
|
179
|
-
- lib/oj/active_support_helper.rb
|
|
180
|
-
- lib/oj/bag.rb
|
|
181
|
-
- lib/oj/easy_hash.rb
|
|
182
|
-
- lib/oj/error.rb
|
|
183
|
-
- lib/oj/json.rb
|
|
184
|
-
- lib/oj/mimic.rb
|
|
185
|
-
- lib/oj/saj.rb
|
|
186
|
-
- lib/oj/schandler.rb
|
|
187
|
-
- lib/oj/state.rb
|
|
188
|
-
- lib/oj/version.rb
|
|
189
186
|
- lib/oj_windows.rb
|
|
190
187
|
- lib/oj_windows/active_support_helper.rb
|
|
191
188
|
- lib/oj_windows/bag.rb
|
|
@@ -238,5 +235,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
238
235
|
requirements: []
|
|
239
236
|
rubygems_version: 3.6.9
|
|
240
237
|
specification_version: 4
|
|
241
|
-
summary:
|
|
238
|
+
summary: A build of the Oj JSON parser for Ruby compiled with the MSVC (mswin) toolchain
|
|
242
239
|
test_files: []
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'active_support/time'
|
|
4
|
-
|
|
5
|
-
module Oj
|
|
6
|
-
# Exists only to handle the ActiveSupport::TimeWithZone.
|
|
7
|
-
class ActiveSupportHelper
|
|
8
|
-
def self.createTimeWithZone(utc, zone)
|
|
9
|
-
ActiveSupport::TimeWithZone.new(utc - utc.gmt_offset, ActiveSupport::TimeZone[zone])
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
Oj.register_odd(ActiveSupport::TimeWithZone, Oj::ActiveSupportHelper, :createTimeWithZone, :utc, 'time_zone.name')
|
|
15
|
-
|
|
16
|
-
# This is a hack to work around an oddness with DateTime and the ActiveSupport
|
|
17
|
-
# that causes a hang when some methods are called from C. Hour, min(ute),
|
|
18
|
-
# sec(ond) and other methods are special but they can be called from C until
|
|
19
|
-
# activesupport/time is required. After that they can not be even though
|
|
20
|
-
# resond_to? returns true. By defining methods to call super the problem goes
|
|
21
|
-
# away. There is obviously some magic going on under the covers that I don't
|
|
22
|
-
# understand.
|
|
23
|
-
class DateTime
|
|
24
|
-
def hour()
|
|
25
|
-
super
|
|
26
|
-
end
|
|
27
|
-
def min()
|
|
28
|
-
super
|
|
29
|
-
end
|
|
30
|
-
def sec()
|
|
31
|
-
super
|
|
32
|
-
end
|
|
33
|
-
def sec_fraction()
|
|
34
|
-
super
|
|
35
|
-
end
|
|
36
|
-
def offset()
|
|
37
|
-
super
|
|
38
|
-
end
|
|
39
|
-
end
|
data/lib/oj/bag.rb
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Oj
|
|
4
|
-
|
|
5
|
-
# A generic class that is used only for storing attributes. It is the base
|
|
6
|
-
# Class for auto-generated classes in the storage system. Instance variables
|
|
7
|
-
# are added using the instance_variable_set() method. All instance variables
|
|
8
|
-
# can be accessed using the variable name (without the @ prefix). No setters
|
|
9
|
-
# are provided as the Class is intended for reading only.
|
|
10
|
-
class Bag
|
|
11
|
-
|
|
12
|
-
# The initializer can take multiple arguments in the form of key values
|
|
13
|
-
# where the key is the variable name and the value is the variable
|
|
14
|
-
# value. This is intended for testing purposes only.
|
|
15
|
-
# @example Oj::Bag.new(:@x => 42, :@y => 57)
|
|
16
|
-
# @param [Hash] args instance variable symbols and their values
|
|
17
|
-
def initialize(args = {})
|
|
18
|
-
args.each do |k, v|
|
|
19
|
-
self.instance_variable_set(k, v)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# Replaces the Object.respond_to?() method.
|
|
24
|
-
# @param [Symbol] m method symbol
|
|
25
|
-
# @return [Boolean] true for any method that matches an instance
|
|
26
|
-
# variable reader, otherwise false.
|
|
27
|
-
def respond_to?(m)
|
|
28
|
-
return true if super
|
|
29
|
-
|
|
30
|
-
instance_variables.include?(:"@#{m}")
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Handles requests for variable values. Others cause an Exception to be
|
|
34
|
-
# raised.
|
|
35
|
-
# @param [Symbol] m method symbol
|
|
36
|
-
# @return [Boolean] the value of the specified instance variable.
|
|
37
|
-
# @raise [ArgumentError] if an argument is given. Zero arguments expected.
|
|
38
|
-
# @raise [NoMethodError] if the instance variable is not defined.
|
|
39
|
-
def method_missing(m, *args, &block)
|
|
40
|
-
raise ArgumentError.new("wrong number of arguments (#{args.size} for 0) to method #{m}") unless args.nil? or args.empty?
|
|
41
|
-
|
|
42
|
-
at_m = :"@#{m}"
|
|
43
|
-
raise NoMethodError.new("undefined method #{m}", m) unless instance_variable_defined?(at_m)
|
|
44
|
-
|
|
45
|
-
instance_variable_get(at_m)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# Replaces eql?() with something more reasonable for this Class.
|
|
49
|
-
# @param [Object] other Object to compare self to
|
|
50
|
-
# @return [Boolean] true if each variable and value are the same, otherwise false.
|
|
51
|
-
def eql?(other)
|
|
52
|
-
return false if (other.nil? or self.class != other.class)
|
|
53
|
-
|
|
54
|
-
ova = other.instance_variables
|
|
55
|
-
iv = instance_variables
|
|
56
|
-
return false if ova.size != iv.size
|
|
57
|
-
|
|
58
|
-
iv.all? { |vid| instance_variable_get(vid) != other.instance_variable_get(vid) }
|
|
59
|
-
end
|
|
60
|
-
alias == eql?
|
|
61
|
-
|
|
62
|
-
# Define a new class based on the Oj::Bag class. This is used internally in
|
|
63
|
-
# the Oj module and is available to service wrappers that receive XML
|
|
64
|
-
# requests that include Objects of Classes not defined in the storage
|
|
65
|
-
# process.
|
|
66
|
-
# @param [String] classname Class name or symbol that includes Module names.
|
|
67
|
-
# @return [Object] an instance of the specified Class.
|
|
68
|
-
# @raise [NameError] if the classname is invalid.
|
|
69
|
-
def self.define_class(classname)
|
|
70
|
-
classname = classname.to_s unless classname.is_a?(String)
|
|
71
|
-
tokens = classname.split('::').map(&:to_sym)
|
|
72
|
-
raise NameError.new("Invalid classname '#{classname}") if tokens.empty?
|
|
73
|
-
|
|
74
|
-
m = Object
|
|
75
|
-
tokens[0..-2].each do |sym|
|
|
76
|
-
if m.const_defined?(sym)
|
|
77
|
-
m = m.const_get(sym)
|
|
78
|
-
else
|
|
79
|
-
c = Module.new
|
|
80
|
-
m.const_set(sym, c)
|
|
81
|
-
m = c
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
sym = tokens[-1]
|
|
85
|
-
if m.const_defined?(sym)
|
|
86
|
-
c = m.const_get(sym)
|
|
87
|
-
else
|
|
88
|
-
c = Class.new(Oj::Bag)
|
|
89
|
-
m.const_set(sym, c)
|
|
90
|
-
end
|
|
91
|
-
c
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
end # Bag
|
|
95
|
-
end # Oj
|
data/lib/oj/easy_hash.rb
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
module Oj
|
|
2
|
-
|
|
3
|
-
# A Hash subclass that normalizes the hash keys to allow lookup by the
|
|
4
|
-
# key.to_s or key.to_sym. It also supports looking up hash values by methods
|
|
5
|
-
# that match the keys.
|
|
6
|
-
class EasyHash < Hash
|
|
7
|
-
|
|
8
|
-
# Replaces the Object.respond_to?() method.
|
|
9
|
-
# @param [Symbol] m method symbol
|
|
10
|
-
# @param [Boolean] include_all whether to include private and protected methods in the search
|
|
11
|
-
# @return [Boolean] true for any method that matches an instance
|
|
12
|
-
# variable reader, otherwise false.
|
|
13
|
-
def respond_to?(m, include_all = false)
|
|
14
|
-
return true if super
|
|
15
|
-
return true if has_key?(m)
|
|
16
|
-
return true if has_key?(m.to_s)
|
|
17
|
-
|
|
18
|
-
has_key?(m.to_sym)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def [](key)
|
|
22
|
-
return fetch(key, nil) if has_key?(key)
|
|
23
|
-
return fetch(key.to_s, nil) if has_key?(key.to_s)
|
|
24
|
-
|
|
25
|
-
fetch(key.to_sym, nil)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Handles requests for Hash values. Others cause an Exception to be raised.
|
|
29
|
-
# @param [Symbol|String] m method symbol
|
|
30
|
-
# @return [Boolean] the value of the specified instance variable.
|
|
31
|
-
# @raise [ArgumentError] if an argument is given. Zero arguments expected.
|
|
32
|
-
# @raise [NoMethodError] if the instance variable is not defined.
|
|
33
|
-
def method_missing(m, *args, &block)
|
|
34
|
-
if m.to_s.end_with?('=')
|
|
35
|
-
raise ArgumentError.new("wrong number of arguments (#{args.size} for 1 with #{m}) to method #{m}") if args.nil? or 1 != args.length
|
|
36
|
-
|
|
37
|
-
m = m[0..-2]
|
|
38
|
-
return store(m.to_s, args[0]) if has_key?(m.to_s)
|
|
39
|
-
return store(m.to_sym, args[0]) if has_key?(m.to_sym)
|
|
40
|
-
|
|
41
|
-
return store(m, args[0])
|
|
42
|
-
else
|
|
43
|
-
raise ArgumentError.new("wrong number of arguments (#{args.size} for 0 with #{m}) to method #{m}") unless args.nil? or args.empty?
|
|
44
|
-
return fetch(m, nil) if has_key?(m)
|
|
45
|
-
return fetch(m.to_s, nil) if has_key?(m.to_s)
|
|
46
|
-
return fetch(m.to_sym, nil) if has_key?(m.to_sym)
|
|
47
|
-
end
|
|
48
|
-
raise NoMethodError.new("undefined method #{m}", m)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
end # EasyHash
|
|
52
|
-
end # Oj
|
data/lib/oj/error.rb
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
module Oj
|
|
2
|
-
|
|
3
|
-
# Inherit Error class from StandardError.
|
|
4
|
-
Error = Class.new(StandardError)
|
|
5
|
-
|
|
6
|
-
# Following classes inherit from the Error class.
|
|
7
|
-
# -----------------------------------------------
|
|
8
|
-
|
|
9
|
-
# An Exception that is raised as a result of a parse error while parsing a JSON document.
|
|
10
|
-
ParseError = Class.new(Error)
|
|
11
|
-
|
|
12
|
-
# An Exception that is raised as a result of a path being too deep.
|
|
13
|
-
DepthError = Class.new(Error)
|
|
14
|
-
|
|
15
|
-
# An Exception that is raised if a file fails to load.
|
|
16
|
-
LoadError = Class.new(Error)
|
|
17
|
-
|
|
18
|
-
# An Exception that is raised if there is a conflict with mimicking JSON
|
|
19
|
-
MimicError = Class.new(Error)
|
|
20
|
-
|
|
21
|
-
end # Oj
|
data/lib/oj/json.rb
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
require 'ostruct'
|
|
2
|
-
require 'oj_windows/state'
|
|
3
|
-
|
|
4
|
-
if defined?(JSON::PRETTY_STATE_PROTOTYPE)
|
|
5
|
-
# There are enough people that try to use both the json gen and oj in mimic
|
|
6
|
-
# mode so don't display the warning.
|
|
7
|
-
|
|
8
|
-
# warn "WARNING: oj_windows/json is a compatability shim used by Oj. Requiring the file explicitly is not recommended."
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
unless defined?(JSON::PRETTY_STATE_PROTOTYPE)
|
|
12
|
-
module JSON
|
|
13
|
-
NaN = 0.0/0.0 unless defined?(::JSON::NaN)
|
|
14
|
-
Infinity = 1.0/0.0 unless defined?(::JSON::Infinity)
|
|
15
|
-
MinusInfinity = -1.0/0.0 unless defined?(::JSON::MinusInfinity)
|
|
16
|
-
# Taken from the unit test. Note that items like check_circular? are not
|
|
17
|
-
# present.
|
|
18
|
-
PRETTY_STATE_PROTOTYPE = Ext::Generator::State.from_state({
|
|
19
|
-
:allow_nan => false,
|
|
20
|
-
:array_nl => "\n",
|
|
21
|
-
:ascii_only => false,
|
|
22
|
-
:buffer_initial_length => 1024,
|
|
23
|
-
:depth => 0,
|
|
24
|
-
:indent => " ",
|
|
25
|
-
:max_nesting => 100,
|
|
26
|
-
:object_nl => "\n",
|
|
27
|
-
:space => " ",
|
|
28
|
-
:space_before => "",
|
|
29
|
-
}) unless defined?(::JSON::PRETTY_STATE_PROTOTYPE)
|
|
30
|
-
SAFE_STATE_PROTOTYPE = Ext::Generator::State.from_state({
|
|
31
|
-
:allow_nan => false,
|
|
32
|
-
:array_nl => "",
|
|
33
|
-
:ascii_only => false,
|
|
34
|
-
:buffer_initial_length => 1024,
|
|
35
|
-
:depth => 0,
|
|
36
|
-
:indent => "",
|
|
37
|
-
:max_nesting => 100,
|
|
38
|
-
:object_nl => "",
|
|
39
|
-
:space => "",
|
|
40
|
-
:space_before => "",
|
|
41
|
-
}) unless defined?(::JSON::SAFE_STATE_PROTOTYPE)
|
|
42
|
-
FAST_STATE_PROTOTYPE = Ext::Generator::State.from_state({
|
|
43
|
-
:allow_nan => false,
|
|
44
|
-
:array_nl => "",
|
|
45
|
-
:ascii_only => false,
|
|
46
|
-
:buffer_initial_length => 1024,
|
|
47
|
-
:depth => 0,
|
|
48
|
-
:indent => "",
|
|
49
|
-
:max_nesting => 0,
|
|
50
|
-
:object_nl => "",
|
|
51
|
-
:space => "",
|
|
52
|
-
:space_before => "",
|
|
53
|
-
}) unless defined?(::JSON::FAST_STATE_PROTOTYPE)
|
|
54
|
-
|
|
55
|
-
def self.dump_default_options
|
|
56
|
-
Oj::MimicDumpOption.new
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def self.dump_default_options=(h)
|
|
60
|
-
m = Oj::MimicDumpOption.new
|
|
61
|
-
h.each do |k, v|
|
|
62
|
-
m[k] = v
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def self.parser=(p)
|
|
67
|
-
@@parser = p
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def self.parser()
|
|
71
|
-
@@parser
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def self.generator=(g)
|
|
75
|
-
@@generator = g
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def self.generator()
|
|
79
|
-
@@generator
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
module Ext
|
|
83
|
-
class Parser
|
|
84
|
-
def initialize(src)
|
|
85
|
-
raise TypeError.new("already initialized") unless @source.nil?
|
|
86
|
-
|
|
87
|
-
@source = src
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def source()
|
|
91
|
-
raise TypeError.new("already initialized") if @source.nil?
|
|
92
|
-
|
|
93
|
-
@source
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
def parse()
|
|
97
|
-
raise TypeError.new("already initialized") if @source.nil?
|
|
98
|
-
|
|
99
|
-
JSON.parse(@source)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
end # Parser
|
|
103
|
-
end # Ext
|
|
104
|
-
|
|
105
|
-
State = ::JSON::Ext::Generator::State unless defined?(::JSON::State)
|
|
106
|
-
|
|
107
|
-
begin
|
|
108
|
-
send(:remove_const, :Parser)
|
|
109
|
-
rescue
|
|
110
|
-
# ignore and move on
|
|
111
|
-
end
|
|
112
|
-
Parser = ::JSON::Ext::Parser unless defined?(::JSON::Parser)
|
|
113
|
-
self.parser = ::JSON::Ext::Parser
|
|
114
|
-
self.generator = ::JSON::Ext::Generator
|
|
115
|
-
|
|
116
|
-
# Taken directly from the json gem. Shamelessly copied. It is similar in
|
|
117
|
-
# some ways to the Oj::Bag class or the Oj::EasyHash class.
|
|
118
|
-
class GenericObject < OpenStruct
|
|
119
|
-
class << self
|
|
120
|
-
alias [] new
|
|
121
|
-
|
|
122
|
-
def json_creatable?
|
|
123
|
-
@json_creatable
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
attr_writer :json_creatable
|
|
127
|
-
|
|
128
|
-
def json_create(data)
|
|
129
|
-
data = data.dup
|
|
130
|
-
data.delete JSON.create_id
|
|
131
|
-
self[data]
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
def from_hash(object)
|
|
135
|
-
case
|
|
136
|
-
when object.respond_to?(:to_hash)
|
|
137
|
-
result = new
|
|
138
|
-
object.to_hash.each do |key, value|
|
|
139
|
-
result[key] = from_hash(value)
|
|
140
|
-
end
|
|
141
|
-
result
|
|
142
|
-
when object.respond_to?(:to_ary)
|
|
143
|
-
object.to_ary.map { |a| from_hash(a) }
|
|
144
|
-
else
|
|
145
|
-
object
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
def load(source, proc = nil, opts = {})
|
|
150
|
-
result = ::JSON.load(source, proc, opts.merge(:object_class => self))
|
|
151
|
-
result.nil? ? new : result
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
def dump(obj, *args)
|
|
155
|
-
::JSON.dump(obj, *args)
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
end # self
|
|
159
|
-
|
|
160
|
-
self.json_creatable = false
|
|
161
|
-
|
|
162
|
-
def to_hash
|
|
163
|
-
table
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
def [](name)
|
|
167
|
-
__send__(name)
|
|
168
|
-
end unless method_defined?(:[])
|
|
169
|
-
|
|
170
|
-
def []=(name, value)
|
|
171
|
-
__send__("#{name}=", value)
|
|
172
|
-
end unless method_defined?(:[]=)
|
|
173
|
-
|
|
174
|
-
def |(other)
|
|
175
|
-
self.class[other.to_hash.merge(to_hash)]
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
def as_json(*)
|
|
179
|
-
{ JSON.create_id => self.class.name }.merge to_hash
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
def to_json(*a)
|
|
183
|
-
as_json.to_json(*a)
|
|
184
|
-
end
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
end # JSON
|
|
188
|
-
end
|