Class: Appraisal::OrderedHash
- Inherits:
-
Hash
- Object
- Hash
- Appraisal::OrderedHash
- Defined in:
- lib/appraisal/ordered_hash.rb
Overview
An ordered hash implementation for Ruby 1.8.7 compatibility. This is not a complete implementation, but it covers Appraisal’s specific needs.
Instance Method Summary collapse
- #[]=(key, value) ⇒ Object
-
#initialize(*args, &block) ⇒ OrderedHash
constructor
A new instance of OrderedHash.
- #values ⇒ Object
Constructor Details
#initialize(*args, &block) ⇒ OrderedHash
Returns a new instance of OrderedHash.
7 8 9 10 |
# File 'lib/appraisal/ordered_hash.rb', line 7 def initialize(*args, &block) super @keys = [] end |
Instance Method Details
#[]=(key, value) ⇒ Object
12 13 14 15 |
# File 'lib/appraisal/ordered_hash.rb', line 12 def []=(key, value) @keys << key unless has_key?(key) super end |
#values ⇒ Object
17 18 19 |
# File 'lib/appraisal/ordered_hash.rb', line 17 def values @keys.collect { |key| self[key] } end |