class Kramdown::Utils::OrderedHash

methods defined in this class may be used when working with OrderedHash on Ruby 1.9.
automatically preserves the insertion order. However, to remain compatibility only the
Note that this class is only used on Ruby 1.8 since the built-in Hash on Ruby 1.9
A partial hash implementation which preserves the insertion order of the keys.

def ==(other) #:nodoc:

:nodoc:
def ==(other) #:nodoc:
  return false unless other.kind_of?(self.class)
  @data == other.instance_variable_get(:@data) && @order == other.instance_variable_get(:@order)
end

def [](key)

Return the value for the +key+.
def [](key)
  @data[key]
end

def []=(key, val)

Set the value for the +key+ to +val+.
def []=(key, val)
  @order << key if !@data.has_key?(key)
  @data[key] = val
end

def delete(key)

Delete the +key+.
def delete(key)
  @order.delete(key)
  @data.delete(key)
end

def dup #:nodoc:

:nodoc:
def dup #:nodoc:
  new_object = super
  new_object.instance_variable_set(:@data, @data.dup)
  new_object.instance_variable_set(:@order, @order.dup)
  new_object
end

def each

Iterate over the stored keys in insertion order.
def each
  @order.each {|k| yield(k, @data[k])}
end

def has_key?(key)

Return +true+ if the hash contains the key.
def has_key?(key)
  @data.has_key?(key)
end

def initialize

Initialize the OrderedHash object.
def initialize
  @data =  {}
  @order = []
end

def inspect #:nodoc:

:nodoc:
def inspect #:nodoc:
  "{" + map {|k,v| "#{k.inspect}=>#{v.inspect}"}.join(" ") + "}"
end

def merge!(other)

def merge!(other)
  other.each {|k,v| self[k] = v}
  self
end