Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/randomperson/ext/array.rb

Instance Method Summary collapse

Instance Method Details

#index_in_range(n) ⇒ Object

This will iterate over an array of ranges, and if the given n is in the range it will return the index for that range.



6
7
8
9
10
11
# File 'lib/randomperson/ext/array.rb', line 6

def index_in_range( n )
  self.each_with_index do |x, i|
    return i if x === n
  end
  return nil
end