123456789_123456789_123456789_123456789_123456789_

Class: Psych::Visitors::Visitor

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: ext/psych/psych_yaml_tree.c,
ext/psych/psych_to_ruby.c,
ext/psych/lib/psych/visitors/visitor.rb

Class Method Summary

Instance Method Summary

Class Method Details

.dispatch_cache (private)

This method is for internal use only.
[ GitHub ]

  
# 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

Instance Method Details

#accept(target)

[ GitHub ]

  
# File 'ext/psych/lib/psych/visitors/visitor.rb', line 5

def accept target
  visit target
end

#dispatch (private)

[ GitHub ]

  
# 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) (private)

[ GitHub ]

  
# File 'ext/psych/lib/psych/visitors/visitor.rb', line 29

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