[ruby/yaml] Make YAML::DBM optional
https://github.com/ruby/yaml/commit/f7c44d3fd7
This commit is contained in:
parent
1d7547f50d
commit
21bac99122
@ -1,6 +1,10 @@
|
|||||||
# frozen_string_literal: false
|
# frozen_string_literal: false
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
require 'dbm'
|
|
||||||
|
begin
|
||||||
|
require 'dbm'
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
|
|
||||||
module YAML
|
module YAML
|
||||||
|
|
||||||
@ -288,4 +292,4 @@ class DBM < ::DBM
|
|||||||
alias :each :each_pair
|
alias :each :each_pair
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end if defined?(DBM)
|
||||||
|
@ -43,4 +43,4 @@ class TestYAMLDBM < Test::Unit::TestCase
|
|||||||
@dbm["key"] = "value"
|
@dbm["key"] = "value"
|
||||||
assert_equal ["key", "value"], @dbm.shift
|
assert_equal ["key", "value"], @dbm.shift
|
||||||
end
|
end
|
||||||
end
|
end if defined?(YAML::DBM)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user