moxml 0.6.1 → 0.6.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/moxml/config.rb +6 -1
- data/lib/moxml/version.rb +1 -1
- data/spec/moxml/config_spec.rb +31 -5
- 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: 18abacdd26eb9008a7b56f975db89664ae24375624ff403ae7d7125516d19bff
|
|
4
|
+
data.tar.gz: 31830c7093c075b8258388a1c317459479ff592d00c49b3cf76a4c5ed5ae1a9b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 89de7734c64bc40ba40f07e2bb4d79a9ff5770c875d6f6df8b2437d9829d821ecbaeb0bd9b233f53f2e9fcbc64d5c43601fb206db4a6ff7d30472f0d9a110a5e
|
|
7
|
+
data.tar.gz: 22c17b78b3674c465f4bba84387627fa4831542acc84d3dfcf721f48886bdca3d994ae92f42145e60f73c5ff0f3578a3f28d929314d3093b10f9604a7a3779ef
|
data/lib/moxml/config.rb
CHANGED
|
@@ -197,7 +197,12 @@ module Moxml
|
|
|
197
197
|
end
|
|
198
198
|
|
|
199
199
|
@adapter_name = name
|
|
200
|
-
adapter
|
|
200
|
+
# Load lazily (the #adapter reader): assignment must not require
|
|
201
|
+
# the adapter's gem. Moxml.new(:rexml) on a nokogiri-less machine
|
|
202
|
+
# crashed here because Config#initialize consults Config.default,
|
|
203
|
+
# whose construction eagerly loaded the FALLBACK adapter. The
|
|
204
|
+
# load now happens at first use and raises the same AdapterError
|
|
205
|
+
# there.
|
|
201
206
|
end
|
|
202
207
|
|
|
203
208
|
def default_adapter=(name)
|
data/lib/moxml/version.rb
CHANGED
data/spec/moxml/config_spec.rb
CHANGED
|
@@ -131,15 +131,16 @@ RSpec.describe Moxml::Config do
|
|
|
131
131
|
expect { config.adapter = :invalid }.to raise_error(Moxml::AdapterError)
|
|
132
132
|
end
|
|
133
133
|
|
|
134
|
-
it "
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
it "loads the adapter gem at first use" do
|
|
135
|
+
config.adapter = :oga
|
|
136
|
+
config.adapter
|
|
137
137
|
expect(defined?(Oga)).to be_truthy
|
|
138
138
|
end
|
|
139
139
|
|
|
140
|
-
it "
|
|
140
|
+
it "delays missing-gem errors from assignment to first use" do
|
|
141
141
|
allow(Moxml::Adapter).to receive(:require).and_raise(LoadError)
|
|
142
|
-
|
|
142
|
+
config.adapter = :nokogiri
|
|
143
|
+
expect { config.adapter }.to raise_error(Moxml::AdapterError)
|
|
143
144
|
end
|
|
144
145
|
end
|
|
145
146
|
|
|
@@ -159,4 +160,29 @@ RSpec.describe Moxml::Config do
|
|
|
159
160
|
expect(config.adapter).not_to eq(original)
|
|
160
161
|
end
|
|
161
162
|
end
|
|
163
|
+
|
|
164
|
+
describe "non-default context construction (moxml#518)" do
|
|
165
|
+
it "does not load the fallback adapter when a named adapter is given" do
|
|
166
|
+
script = <<~'RUBY'
|
|
167
|
+
require "moxml"
|
|
168
|
+
ctx = Moxml.new(:rexml)
|
|
169
|
+
xml = ctx.parse('<person xmlns:x="urn:x" x:id="7"><name>A</name></person>').to_xml
|
|
170
|
+
loaded = $LOADED_FEATURES.map { |f| File.basename(f, ".rb") }
|
|
171
|
+
if loaded.include?("moxml/adapter/nokogiri")
|
|
172
|
+
abort "FAIL: fallback adapter (nokogiri) loaded for a :rexml context"
|
|
173
|
+
end
|
|
174
|
+
unless xml.include?("person")
|
|
175
|
+
abort "FAIL: rexml serialize produced no output: #{xml.inspect}"
|
|
176
|
+
end
|
|
177
|
+
puts "OK"
|
|
178
|
+
RUBY
|
|
179
|
+
out = IO.popen(
|
|
180
|
+
[RbConfig.ruby, "-e", script],
|
|
181
|
+
err: ["/dev/null", "w"],
|
|
182
|
+
"RUBYOPT" => "-rbundler/setup",
|
|
183
|
+
&:read
|
|
184
|
+
)
|
|
185
|
+
expect(out.strip).to eq("OK")
|
|
186
|
+
end
|
|
187
|
+
end
|
|
162
188
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moxml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
Moxml is a unified XML manipulation library that provides a common API
|