Hash
![show/hide quicksearch [+]](../../../images/find.png)
 
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 16
def []=(key, value)
  @keys << key unless key?(key)
  super
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 83
def clear
  super
  @keys.clear
  self
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 21
def delete(key)
  if key? key
    index = @keys.index(key)
    @keys.delete_at index
  end
  super
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 29
def delete_if
  super
  sync_keys!
  self
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 69
def each
  return to_enum(:each) unless block_given?
  @keys.each { |key| yield([key, self[key]]) }
  self
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 57
def each_key
  return to_enum(:each_key) unless block_given?
  @keys.each { |key| yield(key) }
  self
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 75
def each_pair
  return to_enum(:each_pair) unless block_given?
  @keys.each { |key| yield(key, self[key]) }
  self
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 63
def each_value
  return to_enum(:each_value) unless block_given?
  @keys.each { |key| yield(self[key]) }
  self
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 10
def initialize_copy(other)
  super
  # make a deep copy of keys
  @keys = other.keys
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 117
def inspect
  "#<#{self.class} #{super}>"
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 41
def keys
  @keys.dup
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 106
def merge(other_hash, &block)
  dup.merge!(other_hash, &block)
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 95
def merge!(other_hash)
  if block_given?
    other_hash.each { |k, v| self[k] = key?(k) ? yield(k, self[k], v) : v }
  else
    other_hash.each { |k, v| self[k] = v }
  end
  self
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 37
def reject(&block)
  dup.reject!(&block)
end
             
            When replacing with another hash, the initial order of our keys must come from the other hash -ordered or not.
 
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 111
def replace(other)
  super
  @keys = other.keys
  self
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 89
def shift
  k = @keys.first
  v = delete(k)
  [k, v]
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 123
def sync_keys!
  @keys.delete_if { |k| !key?(k) }
end
             
             
               # File bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb, line 53
def to_a
  @keys.map { |key| [key, self[key]] }
end