Sha256: 22eb6b08e4ec1abb6e0495d7d51241f4fe6b5c4e87a3a49ea3ecc3ef01e90870

Contents?: true

Size: 702 Bytes

Versions: 6518

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true
module Psych
  module Visitors
    class Visitor
      def accept target
        visit target
      end

      private

      # @api private
      def self.dispatch_cache
        Hash.new do |hash, klass|
          hash[klass] = :"visit_#{klass.name.gsub('::', '_')}"
        end.compare_by_identity
      end

      if defined?(Ractor)
        def dispatch
          @dispatch_cache ||= (Ractor.current[:Psych_Visitors_Visitor] ||= Visitor.dispatch_cache)
        end
      else
        DISPATCH = dispatch_cache
        def dispatch
          DISPATCH
        end
      end

      def visit target
        send dispatch[target.class], target
      end
    end
  end
end

Version data entries

6,518 entries across 6,515 versions & 24 rubygems

Version Path
psych-5.2.3-java lib/psych/visitors/visitor.rb
psych-5.2.3 lib/psych/visitors/visitor.rb
cybrid_api_bank_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_id_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_organization_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_bank_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_id_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_organization_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_bank_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_organization_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_id_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
ory-client-1.16.2 vendor/bundle/ruby/3.1.0/gems/psych-4.0.6/lib/psych/visitors/visitor.rb
avalara_sdk-24.12.2 vendor/bundle/ruby/2.7.0/gems/psych-4.0.4/lib/psych/visitors/visitor.rb
cybrid_api_bank_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_organization_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_id_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_bank_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_id_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
cybrid_api_organization_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/psych-5.2.2/lib/psych/visitors/visitor.rb
ory-client-1.16.1 vendor/bundle/ruby/3.1.0/gems/psych-4.0.6/lib/psych/visitors/visitor.rb