lib/liszt/redis_list.rb
# Swap the position of the given id with the one above it. If it's at the
# top of the list or not present in the list, do nothing.
# @param [Fixnum] id
Swap the position of the given id with the one above it. If it's at the
top of the list or not present in the list, do nothing.
Swap the position of the given id with the one above it . If it ' s at the top of the list or not present in the list do nothing .
def move_up(id)
      with_lock do
        position = index(id)
        if position.nil? or position == 0
          nil
        else
          prev_id = get(position - 1)
          redis.multi do
            set(position - 1, id)
            set(position, prev_id)
          end
        end
      end
    end
def move_up ( id ) with_lock do position = index ( id ) if position . nil? or position == 0 nil else prev_id = get ( position - 1 ) redis . multi do set ( position - 1 , id ) set ( position , prev_id ) end end end end
Swap the position of the given id with the one above it.
Swap the position of the given id with the one above it .
id
<not_specific>
<not_specific>
None