class Psych::Visitors::Visitor - RDoc Documentation

# class Psych::Visitors::Visitor

### Constants

DISPATCH

### Private Class Methods

dispatch_cache() click to toggle source

@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

### Public Instance Methods

accept(target) click to toggle source

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

### Private Instance Methods

dispatch() click to toggle 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) click to toggle source

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