blob: bab453c33b47d83eef7a253044573aead641e48f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# frozen_string_literal: false
require 'date'
module Psych
DEPRECATED = __FILE__ # :nodoc:
module DeprecatedMethods # :nodoc:
attr_accessor :taguri
attr_accessor :to_yaml_style
end
def self.tagurize thing
warn "#{caller[0]}: add_private_type is deprecated, use add_domain_type" if $VERBOSE
return thing unless String === thing
"tag:yaml.org,2002:#{thing}"
end
def self.read_type_class type, reference
warn "#{caller[0]}: read_type_class is deprecated" if $VERBOSE
_, _, type, name = type.split ':', 4
reference = name.split('::').inject(reference) do |k,n|
k.const_get(n.to_sym)
end if name
[type, reference]
end
def self.object_maker klass, hash
warn "#{caller[0]}: object_maker is deprecated" if $VERBOSE
klass.allocate.tap do |obj|
hash.each { |k,v| obj.instance_variable_set(:"@#{k}", v) }
end
end
end
class Object
undef :to_yaml_properties rescue nil
def to_yaml_properties # :nodoc:
instance_variables
end
end
|