method

revive_hash

Importance_0
v2_1_10 - Show latest stable - 0 notes - Class: ToRuby
revive_hash(hash, o) private

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/to_ruby.rb, line 299
      def revive_hash hash, o
        o.children.each_slice(2) { |k,v|
          key = accept(k)
          val = accept(v)

          if key == '<<'
            case v
            when Nodes::Alias
              begin
                hash.merge! val
              rescue TypeError
                hash[key] = val
              end
            when Nodes::Sequence
              begin
                h = {}
                val.reverse_each do |value|
                  h.merge! value
                end
                hash.merge! h
              rescue TypeError
                hash[key] = val
              end
            else
              hash[key] = val
            end
          else
            hash[key] = val
          end

        }
        hash
      end
Register or log in to add new notes.