class BufferHash

A Hash which is iterated in insertion order. Keys are assumed to be paths; these paths are expanded on read and write.

Public Class Methods

new() click to toggle source
# File lib/diakonos/buffer-hash.rb, line 4
def initialize
  @keys_ = []
end

Public Instance Methods

[]( key ) click to toggle source
Calls superclass method
# File lib/diakonos/buffer-hash.rb, line 8
def [] ( key )
  super File.expand_path( key.to_s )
end
[]=( key, value ) click to toggle source
Calls superclass method
# File lib/diakonos/buffer-hash.rb, line 12
def []= ( key, value )
  key = File.expand_path( key.to_s )
  if ! @keys_.include?( key )
    @keys_ << key
  end
  super key, value
end
clear() click to toggle source
Calls superclass method
# File lib/diakonos/buffer-hash.rb, line 38
def clear
  @keys_ = []
  super
end
delete( key ) click to toggle source
Calls superclass method
# File lib/diakonos/buffer-hash.rb, line 43
def delete( key )
  @keys_.delete key
  super
end
each() { |key, self| ... } click to toggle source
# File lib/diakonos/buffer-hash.rb, line 20
def each
  @keys_.each do |key|
    yield key, self[ key ]
  end
end
each_key() { |key| ... } click to toggle source
# File lib/diakonos/buffer-hash.rb, line 26
def each_key
  @keys_.each do |key|
    yield key
  end
end
each_value() { |self| ... } click to toggle source
# File lib/diakonos/buffer-hash.rb, line 32
def each_value
  @keys_.each do |key|
    yield self[ key ]
  end
end
keys() click to toggle source
# File lib/diakonos/buffer-hash.rb, line 48
def keys
  @keys_.dup
end
length() click to toggle source
# File lib/diakonos/buffer-hash.rb, line 56
def length
  @keys_.length
end
values() click to toggle source
# File lib/diakonos/buffer-hash.rb, line 52
def values
  @keys_.map { |key| self[ key ] }
end