Class: Array

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

Instance Method Summary collapse

Instance Method Details

#to_hash(default = nil) ⇒ Object



10
11
12
# File 'lib/imdb.rb', line 10

def to_hash(default=nil)
  Hash[ *inject([]) { |a, value| a.push value, default || yield(value) } ]
end