Class: Array

Inherits:
Object show all
Defined in:
lib/core_ext/array.rb,
lib/core_ext/symbolize.rb

Instance Method Summary collapse

Instance Method Details

#index(*args, &block) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/core_ext/array.rb', line 3

def index(*args, &block)
  if block_given?
    each_with_index { |v,i| return i if yield(v) }
    return nil
  else 
    old_index(*args)
  end
end

#old_indexObject



2
# File 'lib/core_ext/array.rb', line 2

alias :old_index :index

#symbolizeObject



12
# File 'lib/core_ext/symbolize.rb', line 12

def symbolize; map { |e| e.symbolize }; end