Class: Racket::Misc::OrderedHash
- Inherits:
-
Hash
- Object
- Hash
- Racket::Misc::OrderedHash
- Defined in:
- lib/racket/misc/orderedhash.rb
Overview
members around
Instance Method Summary collapse
- #[]=(key, val) ⇒ Object
- #delete(key) ⇒ Object
- #each ⇒ Object
- #each_key ⇒ Object
- #each_value ⇒ Object
-
#initialize ⇒ OrderedHash
constructor
A new instance of OrderedHash.
Constructor Details
#initialize ⇒ OrderedHash
Returns a new instance of OrderedHash.
35 36 37 |
# File 'lib/racket/misc/orderedhash.rb', line 35 def initialize @keys = [] end |
Instance Method Details
#[]=(key, val) ⇒ Object
39 40 41 42 |
# File 'lib/racket/misc/orderedhash.rb', line 39 def []=(key, val) @keys << key unless (self[key]) super end |
#delete(key) ⇒ Object
44 45 46 47 |
# File 'lib/racket/misc/orderedhash.rb', line 44 def delete(key) @keys.delete(key) super end |
#each ⇒ Object
49 50 51 |
# File 'lib/racket/misc/orderedhash.rb', line 49 def each @keys.each { |k| yield k, self[k] } end |
#each_key ⇒ Object
53 54 55 |
# File 'lib/racket/misc/orderedhash.rb', line 53 def each_key @keys.each { |k| yield k } end |
#each_value ⇒ Object
57 58 59 |
# File 'lib/racket/misc/orderedhash.rb', line 57 def each_value @keys.each { |k| yield self[k] } end |