def append(object)
      # Assume the given object to be the head of its chain
      # B. If it is not, chain B will be split before the
      # object, and the sub chain in which the object now is
      # the head will be appended.
      sub_chain_b_head = coerce object

      # Grab the first item in this chain. We will need it
      # later.
      target_chain = chain_head

      # Split chain B before the given object and grab the
      # tail of that new sub chain.
      sub_chain_b_tail = sub_chain_b_head.split_before_and_insert target_chain

      # If we are the last item in our chain we need to
      # notify the head that there is a new tail.
      # Otherwise the next item in the list need to be
      # linked up correctly.
      if chain_tail?
        target_chain.prev = sub_chain_b_tail
      else
        sub_chain_b_tail.next = next!
        next!.prev = sub_chain_b_tail
      end

      # Connect sub chain B to this item
      sub_chain_b_head.prev = self
      self.next = sub_chain_b_head

      sub_chain_b_tail
    end
def append(object)
      # Assume the given object to be the head of its chain
      # B. If it is not, chain B will be split before the
      # object, and the sub chain in which the object now is
      # the head will be appended.
      sub_chain_b_head = coerce object

      # Grab the first item in this chain. We will need it
      # later.
      target_chain = chain_head

      # Split chain B before the given object and grab the
      # tail of that new sub chain.
      sub_chain_b_tail = sub_chain_b_head.split_before_and_insert target_chain

      # If we are the last item in our chain we need to
      # notify the head that there is a new tail.
      # Otherwise the next item in the list need to be
      # linked up correctly.
      if chain_tail?
        target_chain.prev = sub_chain_b_tail
      else
        sub_chain_b_tail.next = next!
        next!.prev = sub_chain_b_tail
      end

      # Connect sub chain B to this item
      sub_chain_b_head.prev = self
      self.next = sub_chain_b_head

      sub_chain_b_tail
    end
rubocop:disable Metrics/MethodLength