Method: Psych::Visitors::ToRuby#accept

Defined in:
lib/psych/visitors/to_ruby.rb

#accept(target) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/psych/visitors/to_ruby.rb', line 33

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