Class: Array
- Defined in:
- lib/inactive_support/array/butlast.rb,
lib/inactive_support/array/butfirst.rb
Instance Method Summary collapse
-
#butfirst ⇒ Object
Returns the tail of the array.
-
#butlast ⇒ Object
Returns all elements excluding the last one.
Instance Method Details
#butfirst ⇒ Object
Returns the tail of the array
5 6 7 8 9 10 11 |
# File 'lib/inactive_support/array/butfirst.rb', line 5 def butfirst if empty? [] else self[1..-1] end end |
#butlast ⇒ Object
Returns all elements excluding the last one
5 6 7 8 9 10 11 |
# File 'lib/inactive_support/array/butlast.rb', line 5 def butlast if empty? [] else self[0...-1] end end |