Method: Positionable::InstanceMethods#insert_at

Defined in:
lib/positionable.rb

#insert_at(position = :top, list_name = :default) ⇒ Object

Insert the item at the given position (defaults to the top position).



125
126
127
128
129
130
131
132
# File 'lib/positionable.rb', line 125

def insert_at(position = :top, list_name = :default)
  if !position.is_a?(Symbol) && position <= 0
    position = :top
  elsif !position.is_a?(Symbol) && position > bottom_position_in_list(list_name) && position != 1
    position = :bottom
  end
  insert_at_position(list_name, position)
end