diff options
author | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2017-03-10 11:36:48 +0900 |
---|---|---|
committer | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2017-03-27 10:10:44 +0900 |
commit | 4f76651749d338ead0d1d28ec55645b2a311082c (patch) | |
tree | f4e664b0575ea455630af9eae092178cab4dce91 /lib | |
parent | e2e867de11cec54ed508de2d6659be26b73cdb31 (diff) | |
download | psych-4f76651749d338ead0d1d28ec55645b2a311082c.zip |
Remove to_yaml_propaties
Diffstat (limited to 'lib')
-rw-r--r-- | lib/psych.rb | 1 | ||||
-rw-r--r-- | lib/psych/deprecated.rb | 18 | ||||
-rw-r--r-- | lib/psych/visitors/yaml_tree.rb | 24 |
3 files changed, 2 insertions, 41 deletions
diff --git a/lib/psych.rb b/lib/psych.rb index b117b25..9959320 100644 --- a/lib/psych.rb +++ b/lib/psych.rb @@ -17,7 +17,6 @@ require 'psych/omap' require 'psych/set' require 'psych/coder' require 'psych/core_ext' -require 'psych/deprecated' require 'psych/stream' require 'psych/json/tree_builder' require 'psych/json/stream' diff --git a/lib/psych/deprecated.rb b/lib/psych/deprecated.rb deleted file mode 100644 index 8046ba4..0000000 --- a/lib/psych/deprecated.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: false -require 'date' - -module Psych - DEPRECATED = __FILE__ # :nodoc: - - module DeprecatedMethods # :nodoc: - attr_accessor :taguri - attr_accessor :to_yaml_style - end -end - -class Object - undef :to_yaml_properties rescue nil - def to_yaml_properties # :nodoc: - instance_variables - end -end diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb index 55edbc0..978af00 100644 --- a/lib/psych/visitors/yaml_tree.rb +++ b/lib/psych/visitors/yaml_tree.rb @@ -336,7 +336,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 +527,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 +568,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 |