def sorted_puts(line)
      if line == nil || line.size == 0
        raise ArgumentError, 'Line cannot be blank!'
      end
      if line.index($/)
        raise ArgumentError, "Cannot `puts` a line with extra line endings. Make sure the line does not contain `#{$/.inspect}`"
      end

      matched, idx = binary_seek(line)

      if matched
        # an exact match was found, nothing to do
      else
        if idx == nil
          # append to end of file
          self.seek(0, IO::SEEK_END)
          puts(line)
        else
          self.seek(cached_positions[idx][0], IO::SEEK_SET)
          do_at_current_position{puts(line)}
        end
        update_cached_position(idx, line)
      end
      nil
    end
def sorted_puts(line)
      if line == nil || line.size == 0
        raise ArgumentError, 'Line cannot be blank!'
      end
      if line.index($/)
        raise ArgumentError, "Cannot `puts` a line with extra line endings. Make sure the line does not contain `#{$/.inspect}`"
      end

      matched, idx = binary_seek(line)

      if matched
        # an exact match was found, nothing to do
      else
        if idx == nil
          # append to end of file
          self.seek(0, IO::SEEK_END)
          puts(line)
        else
          self.seek(cached_positions[idx][0], IO::SEEK_SET)
          do_at_current_position{puts(line)}
        end
        update_cached_position(idx, line)
      end
      nil
    end
adds the line to the while maintaining the data's sort order

 @param [String] line to add to the file, it should not have it's own line ending.
 @return [Nil] always returns nil to match standard #puts method