Class: Hash::Ordered

Inherits:
Hash
  • Object
show all
Defined in:
charset_alias.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



13
14
15
# File 'charset_alias.rb', line 13

def [](key)
  val = super and val.last
end

#[]=(key, val) ⇒ Object



16
17
18
19
# File 'charset_alias.rb', line 16

def []=(key, val)
  ary = fetch(key) {return super(key, [self.size, key, val])} and
    ary << val
end

#each(&block) ⇒ Object



23
24
25
# File 'charset_alias.rb', line 23

def each(&block)
  sort.each(&block)
end

#sortObject



20
21
22
# File 'charset_alias.rb', line 20

def sort
  values.sort.collect {|i, *rest| rest}
end