Class OrderedHash
In: lib/sass/util/ordered_hash.rb
Parent: ::Hash

This class was copied from an old version of ActiveSupport.

Methods

[]   []=   clear   delete   delete_if   each   each_key   each_pair   each_value   initialize_copy   inspect   invert   keys   merge   merge!   new   reject   reject!   replace   shift   to_a   to_hash   update   values  

External Aliases

find_all -> select

Public Class methods

In MRI the Hash class is core and written in C. In particular, methods are programmed with explicit C function calls and polymorphism is not honored.

For example, []= is crucial in this implementation to maintain the @keys array but hash.c invokes rb_hash_aset() originally. This prevents method reuse through inheritance and forces us to reimplement stuff.

For instance, we cannot use the inherited merge! because albeit the algorithm itself would work, our []= is not being called at all by the C code.

Public Instance methods

When replacing with another hash, the initial order of our keys must come from the other hash — ordered or not.

update(other_hash)

Alias for merge!

[Validate]