Flowdock
method

accept

Importance_0
v1_9_3_125 - Show latest stable - 0 notes - Class: YAMLTree
accept(target) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File ext/psych/lib/psych/visitors/yaml_tree.rb, line 71
      def accept target
        # return any aliases we find
        if @st.key? target.object_id
          oid         = target.object_id
          node        = @st[oid]
          anchor      = oid.to_s
          node.anchor = anchor
          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
          send(@dispatch_cache[target.class], target)
        end
      end
Register or log in to add new notes.