Class: Array

Inherits:
Object show all
Defined in:
lib/ImpURI/Array/lastX.rb,
lib/ImpURI/Array/blankQ.rb,
lib/ImpURI/Array/firstX.rb,
lib/ImpURI/Array/all_but_last.rb,
lib/ImpURI/Array/all_but_first.rb,
lib/ImpURI/Array/extract_optionsX.rb

Overview

History: Stolen wholesale from ActiveSupport.

Instance Method Summary collapse

Instance Method Details

#all_but_firstObject



5
6
7
8
9
# File 'lib/ImpURI/Array/all_but_first.rb', line 5

def all_but_first
  d = self.dup
  d.first!
  d
end

#all_but_lastObject



18
19
20
21
22
# File 'lib/ImpURI/Array/all_but_last.rb', line 18

def all_but_last
  d = self.dup
  d.last!
  d
end

#extract_options!Object



10
11
12
# File 'lib/ImpURI/Array/extract_optionsX.rb', line 10

def extract_options!
  last.is_a?(::Hash) ? pop : {}
end