Class | Kwalify::Util::OrderedHash
In: | kwalify/util/ordered-hash.rb
Parent: | Hash

### Methods

[]= add delete each keys new put values

### External Aliases

[]= | -> | __set__

### Public Class methods

new(*args, &block)

[Source]

    # File kwalify/util/ordered-hash.rb, line 13
          def initialize(*args, &block)
            super
            @_keys = []
          end

### Public Instance methods

[]=(key, val)

Alias for put

add(key, val)

[Source]

    # File kwalify/util/ordered-hash.rb, line 25
          def add(key, val)
            @_keys.delete_at(@_keys.index(key)) if self.key?(key)
            @_keys << key
            __set__(key, val)
          end

delete(key)

[Source]

    # File kwalify/util/ordered-hash.rb, line 42
          def delete(key)
            @_keys.delete_at(@_keys.index(key)) if self.key?(key)
            super
          end

each() {|key, self[key]| ...}

[Source]

    # File kwalify/util/ordered-hash.rb, line 47
          def each
            @_keys.each do |key|
              yield key, self[key]
            end
          end

keys()

alias []= add

[Source]

    # File kwalify/util/ordered-hash.rb, line 34
          def keys
            return @_keys.dup
          end

put(key, val)

[Source]

    # File kwalify/util/ordered-hash.rb, line 20
          def put(key, val)
            @_keys << key unless self.key?(key)
            __set__(key, val)
          end

values()

[Source]

    # File kwalify/util/ordered-hash.rb, line 38
          def values
            return @_keys.collect {|key| self[key] }
          end

[Validate]