Module: Thoran::Array::LastX

Defined in:
lib/Thoran/Array/LastX/lastX.rb

Instance Method Summary collapse

Instance Method Details

#last!(n = 1) ⇒ Object



23
24
25
26
27
# File 'lib/Thoran/Array/LastX/lastX.rb', line 23

def last!(n = 1)
  return_value = []
  n.times{return_value.unshift(self.pop)}
  return_value.size == 1 ? return_value[0] : return_value
end