File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1263,6 +1263,26 @@ def request_uri
12631263 return res
12641264 end
12651265
1266+ ##
1267+ # Dump of data needed to reconsitute this object using Marshal.load
1268+ # This override is needed to avoid serializing @mutex.
1269+ #
1270+ # @param [Integer] level The maximum depth of objects to dump.
1271+ # @return [String] The dump of data needed to reconsitute this object.
1272+ def _dump ( level )
1273+ value
1274+ end
1275+
1276+ ##
1277+ # Load dumped data to reconsitute marshaled object
1278+ # This override is needed to avoid serializing @mutex.
1279+ #
1280+ # @param [String] data The dump of data needed to reconsitute this object.
1281+ # @return [RDF::URI] The reconsituted object.
1282+ def self . _load ( data )
1283+ new ( data )
1284+ end
1285+
12661286 private
12671287
12681288 ##
Original file line number Diff line number Diff line change 983983 end
984984 end
985985 end
986+
987+ describe 'marshaling' do
988+ subject { RDF ::URI ( "http://example/" ) }
989+
990+ it "marshals them" do
991+ marshaled = Marshal . dump ( subject )
992+ loaded = Marshal . load ( marshaled )
993+
994+ expect ( loaded ) . to eq subject
995+ # It should have a mutex
996+ expect { loaded . freeze } . not_to raise_error
997+ end
998+ end
986999end
You can’t perform that action at this time.
0 commit comments