Method: Array#head
- Defined in:
- lib/ruby/jruby_hack.rb
#head ⇒ Object
Return the first item. Raises an IndexError if the Array is empty?.
18 19 20 21 22 |
# File 'lib/ruby/jruby_hack.rb', line 18 def head raise IndexError, "head of empty list" if empty? x, = self x end |