summaryrefslogtreecommitdiff
path: root/ext/psych
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2020-12-21 20:01:54 -0500
committerMarc-André Lafortune <github@marc-andre.ca>2020-12-23 01:08:38 -0500
commit3ee0ad919034fbc098939979c872d041a82c4334 (patch)
treeba77d50b733bb6b585a9e2887e6c46468f9e1fce /ext/psych
parentd1963adae8373cac771f3d62cd8d92ab11deff9e (diff)
[ruby/psych] Don't use instance variables directly for config
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3953
Diffstat (limited to 'ext/psych')
-rw-r--r--ext/psych/lib/psych.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb
index 347160e..0b62362 100644
--- a/ext/psych/lib/psych.rb
+++ b/ext/psych/lib/psych.rb
@@ -595,28 +595,25 @@ module Psych
end
# :stopdoc:
- @domain_types = {}
def self.add_domain_type domain, type_tag, &block
key = ['tag', domain, type_tag].join ':'
- @domain_types[key] = [key, block]
- @domain_types["tag:#{type_tag}"] = [key, block]
+ domain_types[key] = [key, block]
+ domain_types["tag:#{type_tag}"] = [key, block]
end
def self.add_builtin_type type_tag, &block
domain = 'yaml.org,2002'
key = ['tag', domain, type_tag].join ':'
- @domain_types[key] = [key, block]
+ domain_types[key] = [key, block]
end
def self.remove_type type_tag
- @domain_types.delete type_tag
+ domain_types.delete type_tag
end
- @load_tags = {}
- @dump_tags = {}
def self.add_tag tag, klass
- @load_tags[tag] = klass.name
- @dump_tags[klass] = tag
+ load_tags[tag] = klass.name
+ dump_tags[klass] = tag
end
# Workaround for emulating `warn '...', uplevel: 1` in Ruby 2.4 or lower.
@@ -639,5 +636,8 @@ module Psych
attr_accessor :dump_tags
attr_accessor :domain_types
end
+ self.load_tags = {}
+ self.dump_tags = {}
+ self.domain_types = {}
# :startdoc:
end