Method: Array#second_to_last

Defined in:
activesupport/lib/active_support/core_ext/array/access.rb

#second_to_lastObject

Equal to self[-2].

%w( a b c d e ).second_to_last # => "d"


97
98
99
# File 'activesupport/lib/active_support/core_ext/array/access.rb', line 97

def second_to_last
  self[-2]
end