Class: Array

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

Instance Method Summary collapse

Instance Method Details

#map_nth(n) ⇒ Object



2
3
4
# File 'lib/core_ext.rb', line 2

def map_nth(n)
  map { |elem| elem[n] } rescue self
end

#sort_by_nth(n) ⇒ Object



6
7
8
# File 'lib/core_ext.rb', line 6

def sort_by_nth(n)
  sort_by { |elem| elem[n] } rescue self
end