Class: Array

Inherits:
Object show all
Defined in:
lib/core_ext/array.rb

Instance Method Summary collapse

Instance Method Details

#extract_options!Object



2
3
4
# File 'lib/core_ext/array.rb', line 2

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

#move_to_back(*entries) ⇒ Object



12
13
14
15
16
# File 'lib/core_ext/array.rb', line 12

def move_to_back(*entries)
  entries.each do |entry|
    push(entry) if delete(entry)
  end
end

#move_to_front(*entries) ⇒ Object



6
7
8
9
10
# File 'lib/core_ext/array.rb', line 6

def move_to_front(*entries)
  entries.each do |entry|
    unshift(entry) if delete(entry)
  end
end