Skip to content

Commit

Permalink
[ruby/psych] Extract accessor methods without forwardable
Browse files Browse the repository at this point in the history
  We should leave additional dependency if we leave from them.

ruby/psych@3d0325a774
  • Loading branch information
hsbt authored and matzbot committed Jul 5, 2023
1 parent 62b4983 commit 1e7ddfa
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions ext/psych/lib/psych.rb
Expand Up @@ -696,9 +696,6 @@ def self.add_tag tag, klass

class << self
if defined?(Ractor)
require 'forwardable'
extend Forwardable

class Config
attr_accessor :load_tags, :dump_tags, :domain_types
def initialize
Expand All @@ -712,7 +709,29 @@ def config
Ractor.current[:PsychConfig] ||= Config.new
end

def_delegators :config, :load_tags, :dump_tags, :domain_types, :load_tags=, :dump_tags=, :domain_types=
def load_tags
config.load_tags
end

def dump_tags
config.dump_tags
end

def domain_types
config.domain_types
end

def load_tags=(value)
config.load_tags = value
end

def dump_tags=(value)
config.dump_tags = value
end

def domain_types=(value)
config.domain_types = value
end
else
attr_accessor :load_tags
attr_accessor :dump_tags
Expand Down

0 comments on commit 1e7ddfa

Please sign in to comment.