Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/factoryform/utils.rb

Instance Method Summary collapse

Instance Method Details

#move(from, to) ⇒ Object



2
3
4
# File 'lib/factoryform/utils.rb', line 2

def move(from, to)
  insert(to, delete_at(from))
end

#move_object(obj, to) ⇒ Object



6
7
8
9
# File 'lib/factoryform/utils.rb', line 6

def move_object(obj, to)
  return self if index(obj).nil? # return original array if obj not found
  move(index(obj), to)
end