class Psych::Visitors::ToRuby

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/psych/visitors/to_ruby.rbs

class Psych::Visitors::ToRuby < Psych::Visitors::Psych::Visitors::Visitor
  
  type Psych__Visitors__ToRuby_accept_target = Psych::Nodes::Scalar | Psych::Nodes::Sequence | Psych::Nodes::Mapping | Psych::Nodes::Document
  type Psych__Visitors__ToRuby_accept_return_value = String | Gem::Specification | Gem::Version | Gem::Requirement | nil | Symbol | Gem::Dependency | false | Integer | Time | Array[] | Array[Array, String, Gem::Version] | Array[String] | Array[Gem::Dependency] | Hash
  
  def accept: (Psych__Visitors__ToRuby_accept_target target) -> Psych__Visitors__ToRuby_accept_return_value
  def deduplicate: (String key) -> String
  def deduplicate: (String key) -> String
  
  type Psych__Visitors__ToRuby_deserialize_return_value = String | false | Symbol | Integer | nil | Time
  
  def deserialize: (Psych::Nodes::Scalar o) -> Psych__Visitors__ToRuby_deserialize_return_value
  
  type Psych__Visitors__ToRuby_init_with_o = Gem::Version | Gem::Dependency | Gem::Requirement | Gem::Specification
  type Psych__Visitors__ToRuby_init_with_return_value = Gem::Version | Gem::Dependency | Gem::Requirement | Gem::Specification
  
  def init_with: (Psych__Visitors__ToRuby_init_with_o o, Hash h, Psych::Nodes::Mapping node) -> Psych__Visitors__ToRuby_init_with_return_value
  def initialize: (Psych::ScalarScanner ss, Psych::ClassLoader::Restricted class_loader, symbolize_names: false, freeze: false) -> void
  
  type Psych__Visitors__ToRuby_register_object = String | Array[] | Gem::Requirement | Gem::Dependency | Gem::Version | false | Symbol | Hash | Integer | Time | nil | Gem::Specification
  type Psych__Visitors__ToRuby_register_return_value = String | Gem::Requirement | Gem::Dependency | Gem::Version | false | Symbol | Integer | Time | nil | Gem::Specification | Array[]
  
  def register: ((Psych::Nodes::Scalar | Psych::Nodes::Sequence | Psych::Nodes::Mapping) node, Psych__Visitors__ToRuby_register_object object) -> Psych__Visitors__ToRuby_register_return_value
  def register_empty: (Psych::Nodes::Sequence object) -> (Array[String] | Array[] | Array[Array, String, Gem::Version])
  def resolve_class: (String? klassname) -> Class?
  
  type Psych__Visitors__ToRuby_revive_return_value = Gem::Requirement | Gem::Dependency | Gem::Version | Gem::Specification
  
  def revive: (Class klass, Psych::Nodes::Mapping node) -> Psych__Visitors__ToRuby_revive_return_value
  def revive_hash: (Hash hash, Psych::Nodes::Mapping o, ?bool tagged) -> Hash
  def visit_Psych_Nodes_Document: (Psych::Nodes::Document o) -> Gem::Specification
  def visit_Psych_Nodes_Mapping: (Psych::Nodes::Mapping o) -> (Gem::Dependency | Gem::Requirement | Gem::Version)
  
  type Psych__Visitors__ToRuby_visit_Psych_Nodes_Scalar_return_value = String | Symbol | false | nil | Integer | Time
  
  def visit_Psych_Nodes_Scalar: (Psych::Nodes::Scalar o) -> Psych__Visitors__ToRuby_visit_Psych_Nodes_Scalar_return_value
  def visit_Psych_Nodes_Sequence: (Psych::Nodes::Sequence o) -> (Array[] | Array[String] | Array[Array, String, Gem::Version])
end

This class walks a YAML AST, converting each node to Ruby
##

def self.create(symbolize_names: false, freeze: false, strict_integer: false)

def self.create(symbolize_names: false, freeze: false, strict_integer: false)
  class_loader = ClassLoader.new
  scanner      = ScalarScanner.new class_loader, strict_integer: strict_integer
  new(scanner, class_loader, symbolize_names: symbolize_names, freeze: freeze)
end

def accept target

Experimental RBS support (using type sampling data from the type_fusion project).

type Psych__Visitors__ToRuby_accept_target = Psych::Nodes::Scalar | Psych::Nodes::Sequence | Psych::Nodes::Mapping | Psych::Nodes::Document
type Psych__Visitors__ToRuby_accept_return_value = String | Gem::Specification | Gem::Version | Gem::Requirement | nil | Symbol | Gem::Dependency | false | Integer | Time | Array[] | Array[Array, String, Gem::Version] | Array[String] | Array[Gem::Dependency] | Hash
type Psych__Visitors__ToRuby_accept_return_value = String | Gem::Specification | Gem::Version | Gem::Requirement | nil | Symbol | Gem::Dependency | false | Integer | Time |  | String | String | String | Gem::Version | Array | String | Gem::Version | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency

def accept: (Psych__Visitors__ToRuby_accept_target target) -> Psych__Visitors__ToRuby_accept_return_value

This signature was generated using 2990 samples from 2 applications.

def accept target
  result = super
  unless @domain_types.empty? || !target.tag
    key = target.tag.sub(/^[!\/]*/, '').sub(/(,\d+)\//, '\1:')
    key = "tag:#{key}" unless key =~ /^(?:tag:|x-private)/
    if @domain_types.key? key
      value, block = @domain_types[key]
      result = block.call value, result
    end
  end
  result = deduplicate(result).freeze if @freeze
  result
end

def deduplicate key

Experimental RBS support (using type sampling data from the type_fusion project).

def deduplicate: (String key) -> String

This signature was generated using 256 samples from 2 applications.

def deduplicate key
  if key.is_a?(String)
    # It is important to untaint the string, otherwise it won't
    # be deduplicated into an fstring, but simply frozen.
    -(key.untaint)
  else
    key
  end
end

def deduplicate key

Experimental RBS support (using type sampling data from the type_fusion project).

def deduplicate: (String key) -> String

This signature was generated using 256 samples from 2 applications.

def deduplicate key
  if key.is_a?(String)
    -key
  else
    key
  end
end

def deserialize o

Experimental RBS support (using type sampling data from the type_fusion project).

type Psych__Visitors__ToRuby_deserialize_return_value = String | false | Symbol | Integer | nil | Time

def deserialize: (Psych::Nodes::Scalar o) -> Psych__Visitors__ToRuby_deserialize_return_value

This signature was generated using 1287 samples from 2 applications.

def deserialize o
  if klass = resolve_class(@load_tags[o.tag])
    instance = klass.allocate
    if instance.respond_to?(:init_with)
      coder = Psych::Coder.new(o.tag)
      coder.scalar = o.value
      instance.init_with coder
    end
    return instance
  end
  return o.value if o.quoted
  return @ss.tokenize(o.value) unless o.tag
  case o.tag
  when '!binary', 'tag:yaml.org,2002:binary'
    o.value.unpack('m').first
  when /^!(?:str|ruby\/string)(?::(.*))?$/, 'tag:yaml.org,2002:str'
    klass = resolve_class($1)
    if klass
      klass.allocate.replace o.value
    else
      o.value
    end
  when '!ruby/object:BigDecimal'
    require 'bigdecimal' unless defined? BigDecimal
    class_loader.big_decimal._load o.value
  when "!ruby/object:DateTime"
    class_loader.date_time
    require 'date' unless defined? DateTime
    t = @ss.parse_time(o.value)
    DateTime.civil(*t.to_a[0, 6].reverse, Rational(t.utc_offset, 86400)) +
      (t.subsec/86400)
  when '!ruby/encoding'
    ::Encoding.find o.value
  when "!ruby/object:Complex"
    class_loader.complex
    Complex(o.value)
  when "!ruby/object:Rational"
    class_loader.rational
    Rational(o.value)
  when "!ruby/class", "!ruby/module"
    resolve_class o.value
  when "tag:yaml.org,2002:float", "!float"
    Float(@ss.tokenize(o.value))
  when "!ruby/regexp"
    klass = class_loader.regexp
    o.value =~ /^\/(.*)\/([mixn]*)$/m
    source  = $1
    options = 0
    lang    = nil
    ($2 || '').split('').each do |option|
      case option
      when 'x' then options |= Regexp::EXTENDED
      when 'i' then options |= Regexp::IGNORECASE
      when 'm' then options |= Regexp::MULTILINE
      when 'n' then options |= Regexp::NOENCODING
      else lang = option
      end
    end
    klass.new(*[source, options, lang].compact)
  when "!ruby/range"
    klass = class_loader.range
    args = o.value.split(/([.]{2,3})/, 2).map { |s|
      accept Nodes::Scalar.new(s)
    }
    args.push(args.delete_at(1) == '...')
    klass.new(*args)
  when /^!ruby\/sym(bol)?:?(.*)?$/
    class_loader.symbolize o.value
  else
    @ss.tokenize o.value
  end
end

def init_with o, h, node

Experimental RBS support (using type sampling data from the type_fusion project).

type Psych__Visitors__ToRuby_init_with_o = Gem::Version | Gem::Dependency | Gem::Requirement | Gem::Specification
type Psych__Visitors__ToRuby_init_with_return_value = Gem::Version | Gem::Dependency | Gem::Requirement | Gem::Specification
type Psych__Visitors__ToRuby_init_with_h = version | String | name | String | requirement | Gem::Requirement | type | Symbol | prerelease | FalseClass | version_requirements | Gem::Requirement | force_ruby_platform | FalseClass | name | String | requirement | Gem::Requirement | type | Symbol | prerelease | FalseClass | version_requirements | Gem::Requirement | requirements |  | name | String | version | Gem::Version | platform | String | authors |  | autorequire | NilClass | bindir | String | cert_chain |  | date | Time | dependencies | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | description | String | email | String | executables |  | extensions |  | extra_rdoc_files |  | files | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | homepage | String | licenses |  | metadata | bug_tracker_uri | String | changelog_uri | String | documentation_uri | String | mailing_list_uri | String | source_code_uri | String | rubygems_mfa_required | String | post_install_message | NilClass | rdoc_options | String | require_paths |  | required_ruby_version | Gem::Requirement | required_rubygems_version | Gem::Requirement | requirements |  | rubygems_version | String | signing_key | NilClass | specification_version | Integer | summary | String | test_files |  | name | String | version | Gem::Version | platform | String | authors | String | autorequire | NilClass | bindir | String | cert_chain |  | date | Time | dependencies | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | Gem::Dependency | description | String | email | String | executables |  | extensions |  | extra_rdoc_files |  | files | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | homepage | String | licenses |  | metadata | bug_tracker_uri | String | changelog_uri | String | documentation_uri | String | mailing_list_uri | String | source_code_uri | String | rubygems_mfa_required | String | post_install_message | NilClass | rdoc_options |  | require_paths |  | required_ruby_version | Gem::Requirement | required_rubygems_version | Gem::Requirement | requirements |  | rubygems_version | String | signing_key | NilClass | specification_version | Integer | summary | String | test_files | 

def init_with: (Psych__Visitors__ToRuby_init_with_o o, Psych__Visitors__ToRuby_init_with_h h, Psych::Nodes::Mapping node) -> Psych__Visitors__ToRuby_init_with_return_value

This signature was generated using 102 samples from 2 applications.

def init_with o, h, node
  c = Psych::Coder.new(node.tag)
  c.map = h
  if o.respond_to?(:init_with)
    o.init_with c
  else
    h.each { |k,v| o.instance_variable_set(:"@#{k}", v) }
  end
  o
end

def initialize ss, class_loader, symbolize_names: false, freeze: false

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: (Psych::ScalarScanner ss, Psych::ClassLoader::Restricted class_loader, symbolize_names: false, freeze: false) -> void

This signature was generated using 6 samples from 1 application.

def initialize ss, class_loader, symbolize_names: false, freeze: false
  super()
  @st = {}
  @ss = ss
  @load_tags = Psych.load_tags
  @domain_types = Psych.domain_types
  @class_loader = class_loader
  @symbolize_names = symbolize_names
  @freeze = freeze
end

def merge_key hash, key, val

def merge_key hash, key, val
end

def register node, object

Experimental RBS support (using type sampling data from the type_fusion project).

type Psych__Visitors__ToRuby_register_object = String | Array[] | Gem::Requirement | Gem::Dependency | Gem::Version | false | Symbol | Hash | Integer | Time | nil | Gem::Specification
type Psych__Visitors__ToRuby_register_return_value = String | Gem::Requirement | Gem::Dependency | Gem::Version | false | Symbol | Integer | Time | nil | Gem::Specification | Array[]
type Psych__Visitors__ToRuby_register_object = String |  | Gem::Requirement | Gem::Dependency | Gem::Version | false | Symbol | Integer | Time | nil | Gem::Specification
type Psych__Visitors__ToRuby_register_return_value = String | Gem::Requirement | Gem::Dependency | Gem::Version | false | Symbol | Integer | Time | nil | Gem::Specification | 

def register: ((Psych::Nodes::Scalar | Psych::Nodes::Sequence | Psych::Nodes::Mapping) node, Psych__Visitors__ToRuby_register_object object) -> Psych__Visitors__ToRuby_register_return_value

This signature was generated using 1494 samples from 2 applications.

def register node, object
  @st[node.anchor] = object if node.anchor
  object
end

def register_empty object

Experimental RBS support (using type sampling data from the type_fusion project).

def register_empty: (Psych::Nodes::Sequence object) -> (Gem::Version |  | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String)

This signature was generated using 110 samples from 1 application.

def register_empty object
  list = register(object, [])
  object.children.each { |c| list.push accept c }
  list
end

def resolve_class klassname

Experimental RBS support (using type sampling data from the type_fusion project).

def resolve_class: (String? klassname) -> Class?

This signature was generated using 1474 samples from 2 applications.

Convert +klassname+ to a Class
def resolve_class klassname
  class_loader.load klassname
end

def revive klass, node

Experimental RBS support (using type sampling data from the type_fusion project).

type Psych__Visitors__ToRuby_revive_return_value = Gem::Requirement | Gem::Dependency | Gem::Version | Gem::Specification

def revive: (Class klass, Psych::Nodes::Mapping node) -> Psych__Visitors__ToRuby_revive_return_value

This signature was generated using 91 samples from 1 application.

def revive klass, node
  s = register(node, klass.allocate)
  init_with(s, revive_hash({}, node, true), node)
end

def revive_hash hash, o, tagged= false

Experimental RBS support (using type sampling data from the type_fusion project).

type Psych__Visitors__ToRuby_revive_hash_hash = name | String | requirement | Gem::Requirement | type | Symbol | prerelease | FalseClass | version_requirements | Gem::Requirement | force_ruby_platform | FalseClass | name | String | requirement | Gem::Requirement | type | Symbol | prerelease | FalseClass | version_requirements | Gem::Requirement | version | String | requirements |  | name | String | version | Gem::Version | platform | String | authors | String | String | String | String | String | String | String | String | String | String | String | String | autorequire | NilClass | bindir | String | cert_chain |  | date | Time | dependencies | Gem::Dependency | description | String | email | String | executables |  | extensions |  | extra_rdoc_files | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | files | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | homepage | String | licenses |  | metadata | homepage_uri | String | bug_tracker_uri | String | documentation_uri | String | changelog_uri | String | source_code_uri | String | rubygems_mfa_required | String | post_install_message | NilClass | rdoc_options | String | require_paths |  | required_ruby_version | Gem::Requirement | required_rubygems_version | Gem::Requirement | requirements |  | rubygems_version | String | signing_key | NilClass | specification_version | Integer | summary | String | test_files |  | bug_tracker_uri | String | changelog_uri | String | documentation_uri | String | mailing_list_uri | String | source_code_uri | String | rubygems_mfa_required | String | allowed_push_host | String | name | String | version | Gem::Version | platform | String | authors |  | autorequire | NilClass | bindir | String | cert_chain |  | date | Time | dependencies |  | description | String | email | String | executables |  | extensions |  | extra_rdoc_files | String | String | String | String | String | String | String | String | files | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | homepage | String | licenses |  | metadata |  | post_install_message | NilClass | rdoc_options | String | String | String | String | require_paths |  | required_ruby_version | Gem::Requirement | required_rubygems_version | Gem::Requirement | requirements |  | rubygems_version | String | signing_key | NilClass | specification_version | Integer | summary | String | test_files | String | String | String | String | String
type Psych__Visitors__ToRuby_revive_hash_return_value = name | String | requirement | Gem::Requirement | type | Symbol | prerelease | FalseClass | version_requirements | Gem::Requirement | allowed_push_host | String | version | String | requirements | 

def revive_hash: (Psych__Visitors__ToRuby_revive_hash_hash hash, Psych::Nodes::Mapping o, ?bool tagged) -> Psych__Visitors__ToRuby_revive_hash_return_value

This signature was generated using 114 samples from 1 application.

def revive_hash hash, o, tagged= false
  o.children.each_slice(2) { |k,v|
    key = accept(k)
    val = accept(v)
    if key == '<<' && k.tag != "tag:yaml.org,2002:str"
      case v
      when Nodes::Alias, Nodes::Mapping
        begin
          hash.merge! val
        rescue TypeError
          hash[key] = val
        end
      when Nodes::Sequence
        begin
          h = {}
          val.reverse_each do |value|
            h.merge! value
          end
          hash.merge! h
        rescue TypeError
          hash[key] = val
        end
      else
        hash[key] = val
      end
    else
      if !tagged && @symbolize_names && key.is_a?(String)
        key = key.to_sym
      elsif !@freeze
        key = deduplicate(key)
      end
      hash[key] = val
    end
  }
  hash
end

def visit_Psych_Nodes_Alias o

def visit_Psych_Nodes_Alias o
  @st.fetch(o.anchor) { raise AnchorNotDefined, o.anchor }
end

def visit_Psych_Nodes_Document o

Experimental RBS support (using type sampling data from the type_fusion project).

def visit_Psych_Nodes_Document: (Psych::Nodes::Document o) -> Gem::Specification

This signature was generated using 3 samples from 1 application.

def visit_Psych_Nodes_Document o
  accept o.root
end

def visit_Psych_Nodes_Mapping o

Experimental RBS support (using type sampling data from the type_fusion project).

def visit_Psych_Nodes_Mapping: (Psych::Nodes::Mapping o) -> (Gem::Dependency | Gem::Requirement | Gem::Version)

This signature was generated using 83 samples from 2 applications.

def visit_Psych_Nodes_Mapping o
  if @load_tags[o.tag]
    return revive(resolve_class(@load_tags[o.tag]), o)
  end
  return revive_hash(register(o, {}), o) unless o.tag
  case o.tag
  when /^!ruby\/struct:?(.*)?$/
    klass = resolve_class($1) if $1
    if klass
      s = register(o, klass.allocate)
      members = {}
      struct_members = s.members.map { |x| class_loader.symbolize x }
      o.children.each_slice(2) do |k,v|
        member = accept(k)
        value  = accept(v)
        if struct_members.include?(class_loader.symbolize(member))
          s.send("#{member}=", value)
        else
          members[member.to_s.sub(/^@/, '')] = value
        end
      end
      init_with(s, members, o)
    else
      klass = class_loader.struct
      members = o.children.map { |c| accept c }
      h = Hash[*members]
      s = klass.new(*h.map { |k,v|
        class_loader.symbolize k
      }).new(*h.map { |k,v| v })
      register(o, s)
      s
    end
  when /^!ruby\/object:?(.*)?$/
    name = $1 || 'Object'
    if name == 'Complex'
      class_loader.complex
      h = Hash[*o.children.map { |c| accept c }]
      register o, Complex(h['real'], h['image'])
    elsif name == 'Rational'
      class_loader.rational
      h = Hash[*o.children.map { |c| accept c }]
      register o, Rational(h['numerator'], h['denominator'])
    elsif name == 'Hash'
      revive_hash(register(o, {}), o)
    else
      obj = revive((resolve_class(name) || class_loader.object), o)
      obj
    end
  when /^!(?:str|ruby\/string)(?::(.*))?$/, 'tag:yaml.org,2002:str'
    klass   = resolve_class($1)
    members = {}
    string  = nil
    o.children.each_slice(2) do |k,v|
      key   = accept k
      value = accept v
      if key == 'str'
        if klass
          string = klass.allocate.replace value
        else
          string = value
        end
        register(o, string)
      else
        members[key] = value
      end
    end
    init_with(string, members.map { |k,v| [k.to_s.sub(/^@/, ''),v] }, o)
  when /^!ruby\/array:(.*)$/
    klass = resolve_class($1)
    list  = register(o, klass.allocate)
    members = Hash[o.children.map { |c| accept c }.each_slice(2).to_a]
    list.replace members['internal']
    members['ivars'].each do |ivar, v|
      list.instance_variable_set ivar, v
    end
    list
  when '!ruby/range'
    klass = class_loader.range
    h = Hash[*o.children.map { |c| accept c }]
    register o, klass.new(h['begin'], h['end'], h['excl'])
  when /^!ruby\/exception:?(.*)?$/
    h = Hash[*o.children.map { |c| accept c }]
    e = build_exception((resolve_class($1) || class_loader.exception),
                        h.delete('message'))
    e.set_backtrace h.delete('backtrace') if h.key? 'backtrace'
    init_with(e, h, o)
  when '!set', 'tag:yaml.org,2002:set'
    set = class_loader.psych_set.new
    @st[o.anchor] = set if o.anchor
    o.children.each_slice(2) do |k,v|
      set[accept(k)] = accept(v)
    end
    set
  when /^!ruby\/hash-with-ivars(?::(.*))?$/
    hash = $1 ? resolve_class($1).allocate : {}
    register o, hash
    o.children.each_slice(2) do |key, value|
      case key.value
      when 'elements'
        revive_hash hash, value
      when 'ivars'
        value.children.each_slice(2) do |k,v|
          hash.instance_variable_set accept(k), accept(v)
        end
      end
    end
    hash
  when /^!map:(.*)$/, /^!ruby\/hash:(.*)$/
    revive_hash register(o, resolve_class($1).allocate), o
  when '!omap', 'tag:yaml.org,2002:omap'
    map = register(o, class_loader.psych_omap.new)
    o.children.each_slice(2) do |l,r|
      map[accept(l)] = accept r
    end
    map
  when /^!ruby\/marshalable:(.*)$/
    name = $1
    klass = resolve_class(name)
    obj = register(o, klass.allocate)
    if obj.respond_to?(:init_with)
      init_with(obj, revive_hash({}, o), o)
    elsif obj.respond_to?(:marshal_load)
      marshal_data = o.children.map(&method(:accept))
      obj.marshal_load(marshal_data)
      obj
    else
      raise ArgumentError, "Cannot deserialize #{name}"
    end
  else
    revive_hash(register(o, {}), o)
  end
end

def visit_Psych_Nodes_Scalar o

Experimental RBS support (using type sampling data from the type_fusion project).

type Psych__Visitors__ToRuby_visit_Psych_Nodes_Scalar_return_value = String | Symbol | false | nil | Integer | Time

def visit_Psych_Nodes_Scalar: (Psych::Nodes::Scalar o) -> Psych__Visitors__ToRuby_visit_Psych_Nodes_Scalar_return_value

This signature was generated using 1256 samples from 2 applications.

def visit_Psych_Nodes_Scalar o
  register o, deserialize(o)
end

def visit_Psych_Nodes_Sequence o

Experimental RBS support (using type sampling data from the type_fusion project).

def visit_Psych_Nodes_Sequence: (Psych::Nodes::Sequence o) -> ( | Gem::Version | String)

This signature was generated using 108 samples from 1 application.

def visit_Psych_Nodes_Sequence o
  if klass = resolve_class(@load_tags[o.tag])
    instance = klass.allocate
    if instance.respond_to?(:init_with)
      coder = Psych::Coder.new(o.tag)
      coder.seq = o.children.map { |c| accept c }
      instance.init_with coder
    end
    return instance
  end
  case o.tag
  when nil
    register_empty(o)
  when '!omap', 'tag:yaml.org,2002:omap'
    map = register(o, Psych::Omap.new)
    o.children.each { |a|
      map[accept(a.children.first)] = accept a.children.last
    }
    map
  when /^!(?:seq|ruby\/array):(.*)$/
    klass = resolve_class($1)
    list  = register(o, klass.allocate)
    o.children.each { |c| list.push accept c }
    list
  else
    register_empty(o)
  end
end

def visit_Psych_Nodes_Stream o

def visit_Psych_Nodes_Stream o
  o.children.map { |c| accept c }
end