In Files

  • ruby-3.1.2/ext/psych/lib/psych/visitors/visitor.rb
  • ruby-3.1.2/ext/psych/psych_to_ruby.c

Files

Class/Module Index [+]

Quicksearch

Psych::Visitors::Visitor

Constants

DISPATCH

Private Class Methods

dispatch_cache() click to toggle source

@api private

 
               # File ruby-3.1.2/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
            

Public Instance Methods

accept(target) click to toggle source
 
               # File ruby-3.1.2/ext/psych/lib/psych/visitors/visitor.rb, line 5
def accept target
  visit target
end
            

Private Instance Methods

dispatch() click to toggle source
 
               # File ruby-3.1.2/ext/psych/lib/psych/visitors/visitor.rb, line 19
def dispatch
  @dispatch_cache ||= (Ractor.current[:Psych_Visitors_Visitor] ||= Visitor.dispatch_cache)
end
            
visit(target) click to toggle source
 
               # File ruby-3.1.2/ext/psych/lib/psych/visitors/visitor.rb, line 29
def visit target
  send dispatch[target.class], target
end