Flowdock
method

unify_key

Importance_0
v1_9_2_180 - Show latest stable - 0 notes - Class: JSONTreeView
unify_key(iter, key) private

No documentation

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

Hide source
# File ext/json/lib/json/editor.rb, line 742
      def unify_key(iter, key)
        return unless iter.type == 'Key'
        parent = iter.parent
        if parent.any? { |c| c != iter and c.content == key }
          old_key = key
          i = 0
          begin
            key = sprintf("%s.%d", old_key, i += 1)
          end while parent.any? { |c| c != iter and c.content == key }
        end
        iter.content = key
      end
Register or log in to add new notes.