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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 585ba1c91fa3417c0fbbb93cc0e98caf6231f72c3b56fe9c85503ecab4fc7a66
4
- data.tar.gz: ee2f953d571e5ca408c50e3b245f4f712a8c57e8088560282226166e2226d616
3
+ metadata.gz: 18abacdd26eb9008a7b56f975db89664ae24375624ff403ae7d7125516d19bff
4
+ data.tar.gz: 31830c7093c075b8258388a1c317459479ff592d00c49b3cf76a4c5ed5ae1a9b
5
5
  SHA512:
6
- metadata.gz: 02cbedb6b2220932e6c809ff982ccaf4b3d97b0c7f4b5132702084d61d2fa6209c71b47e59d8f580861d7b2a102103595517a548b7751cbbd054fc5bfedf010b
7
- data.tar.gz: 989a635887455ac0cdaa941f784885041d172e7f1fc64fd4d68b710d879e54f8450bb3364ac4b225a1ed51f6f5cb10554fa4fab600549db6f2c298eb034ab20d
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Moxml
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.2"
5
5
  end
@@ -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 "requires adapter gem" do
135
- expect { config.adapter = :oga }.not_to raise_error
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 "handles missing gems" do
140
+ it "delays missing-gem errors from assignment to first use" do
141
141
  allow(Moxml::Adapter).to receive(:require).and_raise(LoadError)
142
- expect { config.adapter = :nokogiri }.to raise_error(Moxml::AdapterError)
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.1
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-01 00:00:00.000000000 Z
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