class Thor::OrderedHash

while also keeping track of the order in which elements were set.
It keeps the semantics and most of the efficiency of normal hashes
This class is based on the Ruby 1.9 ordered hashes.

def +(other)

def +(other)
  new = clone
  other.each do |key, value|
    new[key] = value unless self[key]
  end
  new
end

def [](key)

def [](key)
  @hash[key] && @hash[key].value
end

def []=(key, value)

def []=(key, value)
  node = Node.new(key, value)
  if old = @hash[key]
    if old.prev
      old.prev.next = old.next
    else # old is @first and @last
      @first = @last = nil
    end
  end
  if @first.nil?
    @first = @last = node
  else
    node.prev = @last
    @last.next = node
    @last = node
  end
  @hash[key] = node
  value
end

def each

def each
  return unless @first
  yield [@first.key, @first.value]
  node = @first
  yield [node.key, node.value] while node = node.next
  self
end

def initialize

def initialize
  @hash = {}
end

def initialize_copy(other)

def initialize_copy(other)
  @hash = other.instance_variable_get('@hash').clone
end

def values

def values
  self.map { |k, v| v }
end