类 Psych::Visitors::Visitor

常量

DISPATCH

私有类方法

dispatch_cache() 点击切换源代码

@api private

# File ext/psych/lib/psych/visitors/visitor.rb, line 12
def self.dispatch_cache
  Hash.new do |hash, klass|
    hash[klass] = :"visit_#{klass.name.gsub('::', '_')}"
  end.compare_by_identity
end

公共实例方法

accept(target) 点击切换源代码
# File ext/psych/lib/psych/visitors/visitor.rb, line 5
def accept target
  visit target
end

私有实例方法

dispatch() 点击切换源代码
# File ext/psych/lib/psych/visitors/visitor.rb, line 19
def dispatch
  @dispatch_cache ||= (Ractor.current[:Psych_Visitors_Visitor] ||= Visitor.dispatch_cache)
end
visit(target) 点击切换源代码
# File ext/psych/lib/psych/visitors/visitor.rb, line 29
def visit target
  send dispatch[target.class], target
end