Class Racket::Misc::OrderedHash
In: lib/racket/misc/orderedhash.rb  (CVS)
Parent: Hash

Simple ordered hash.

XXX: todo — add a method for moving/shifting members around

Methods

[]=   delete   each   each_key   each_value   new  

Public Class methods

[Source]

# File lib/racket/misc/orderedhash.rb, line 35
  def initialize
    @keys = []
  end

Public Instance methods

[Source]

# File lib/racket/misc/orderedhash.rb, line 39
  def []=(key, val)
    @keys << key unless (self[key])
    super
  end

[Source]

# File lib/racket/misc/orderedhash.rb, line 44
  def delete(key)
    @keys.delete(key)
    super
  end

[Source]

# File lib/racket/misc/orderedhash.rb, line 49
  def each
    @keys.each { |k| yield k, self[k] }
  end

[Source]

# File lib/racket/misc/orderedhash.rb, line 53
  def each_key
    @keys.each { |k| yield k }
  end

[Source]

# File lib/racket/misc/orderedhash.rb, line 57
  def each_value
    @keys.each { |k| yield self[k] }
  end

[Validate]