Class: Rgviz::MemoryExecutor::SimpleOrderedHash

Inherits:
Object
  • Object
show all
Defined in:
lib/rgviz/memory_executor.rb

Instance Method Summary collapse

Constructor Details

#initializeSimpleOrderedHash

Returns a new instance of SimpleOrderedHash.



599
600
601
602
# File 'lib/rgviz/memory_executor.rb', line 599

def initialize
  @keys = []
  @hash = Hash.new
end

Instance Method Details

#[](key) ⇒ Object



604
605
606
# File 'lib/rgviz/memory_executor.rb', line 604

def [](key)
  @hash[key]
end

#[]=(key, value) ⇒ Object



608
609
610
611
612
613
# File 'lib/rgviz/memory_executor.rb', line 608

def []=(key, value)
  if !@keys.include?(key)
    @keys << key
  end
  @hash[key] = value
end

#eachObject



615
616
617
618
619
# File 'lib/rgviz/memory_executor.rb', line 615

def each
  @keys.each do |key|
    yield key, @hash[key]
  end
end