class Psych::Visitors::Visitor - Documentation for Ruby 3.4
Description: Documentation for the Psych::Visitors::Visitor class
Keywords: ruby,class,Psych::Visitors::Visitor

# class Psych::Visitors::Visitor

### Constants

DISPATCH

### Public Class Methods

dispatch_cache ()
Source

    # 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

@api private

### Public Instance Methods

accept (target)
Source

    # File ext/psych/lib/psych/visitors/visitor.rb, line 5
    def accept target
      visit target
    end

### Private Instance Methods

dispatch ()
Source

    # 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)
Source

    # File ext/psych/lib/psych/visitors/visitor.rb, line 29
    def visit target
      send dispatch[target.class], target
    end