Class: OrderedHash

Inherits:
Array show all
Defined in:
lib/initializer.rb

Overview

Needs to be duplicated from Active Support since its needed before Active Support is available.

Direct Known Subclasses

OrderedOptions

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



590
591
592
593
# File 'lib/initializer.rb', line 590

def [](key)
  pair = find_pair(key)
  pair ? pair.last : nil
end

#[]=(key, value) ⇒ Object

:nodoc:



581
582
583
584
585
586
587
588
# File 'lib/initializer.rb', line 581

def []=(key, value)    
  if pair = find_pair(key)
    pair.pop
    pair << value
  else
    self << [key, value]
  end
end

#keysObject



595
596
597
# File 'lib/initializer.rb', line 595

def keys
  self.collect { |i| i.first }
end