diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-05 13:16:32 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-05 13:16:32 +0000 |
commit | 6d77e28763ed17f75edf3b4072701b4dbd7644bb (patch) | |
tree | e56f68d61222a1cf4bfc6a63aa640c6546a41b91 /ext/psych/lib/psych/visitors | |
parent | 4389ba641f89fe9d4e5c575442968d385c4183e8 (diff) |
Import psych-3.0.0.beta1 from ruby/psych.
* Removed deprecated code.
* Removed code related syck gem.
* Fixed typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/lib/psych/visitors')
-rw-r--r-- | ext/psych/lib/psych/visitors/to_ruby.rb | 5 | ||||
-rw-r--r-- | ext/psych/lib/psych/visitors/yaml_tree.rb | 51 |
2 files changed, 2 insertions, 54 deletions
diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index fd1c8e6caf..d1318b3ca0 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -380,11 +380,6 @@ module Psych if o.respond_to?(:init_with) o.init_with c - elsif o.respond_to?(:yaml_initialize) - if $VERBOSE - warn "Implementing #{o.class}#yaml_initialize is deprecated, please implement \"init_with(coder)\"" - end - o.yaml_initialize c.tag, c.map else h.each { |k,v| o.instance_variable_set(:"@#{k}", v) } end diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index 11214ecbf4..cae876c872 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/lib/psych/visitors/yaml_tree.rb @@ -53,15 +53,6 @@ module Psych new(emitter, ss, options) end - def self.new emitter = nil, ss = nil, options = nil - return super if emitter && ss && options - - if $VERBOSE - warn "This API is deprecated, please pass an emitter, scalar scanner, and options or call #{self}.create() (#{caller.first})" - end - create emitter, ss - end - def initialize emitter, ss, options super() @started = false @@ -139,24 +130,6 @@ module Psych return @emitter.alias anchor end - if target.respond_to?(:to_yaml) - begin - loc = target.method(:to_yaml).source_location.first - if loc !~ /(syck\/rubytypes.rb|psych\/core_ext.rb)/ - unless target.respond_to?(:encode_with) - if $VERBOSE - warn "implementing to_yaml is deprecated, please implement \"encode_with\"" - end - - target.to_yaml(:nodump => true) - end - end - rescue - # public_method or source_location might be overridden, - # and it's OK to skip it since it's only to emit a warning - end - end - if target.respond_to?(:encode_with) dump_coder target else @@ -336,7 +309,7 @@ module Psych end is_primitive = o.class == ::String - ivars = find_ivars o, is_primitive + ivars = is_primitive ? [] : o.instance_variables if ivars.empty? unless is_primitive @@ -527,24 +500,6 @@ module Psych end end - # FIXME: remove this method once "to_yaml_properties" is removed - def find_ivars target, is_primitive=false - begin - loc = target.method(:to_yaml_properties).source_location.first - unless loc.start_with?(Psych::DEPRECATED) || loc.end_with?('rubytypes.rb') - if $VERBOSE - warn "#{loc}: to_yaml_properties is deprecated, please implement \"encode_with(coder)\"" - end - return target.to_yaml_properties - end - rescue - # public_method or source_location might be overridden, - # and it's OK to skip it since it's only to emit a warning. - end - - is_primitive ? [] : target.instance_variables - end - def register target, yaml_obj @st.register target, yaml_obj yaml_obj @@ -586,9 +541,7 @@ module Psych end def dump_ivars target - ivars = find_ivars target - - ivars.each do |iv| + target.instance_variables.each do |iv| @emitter.scalar("#{iv.to_s.sub(/^@/, '')}", nil, nil, true, false, Nodes::Scalar::ANY) accept target.instance_variable_get(iv) end |