I do not know, what for you are using $curbuf.number (perhaps, for closing list 
of files), but the buffer name could change at least in the following cases:
1. when you open a buffer which is not attached to any file and then write it 
somewhere. Example:
    new
    " echoes nil
    ruby puts $curbuf.name
    w file
    " echoes /path/to/file
    ruby puts $curbuf.name
    qa!
2. when you open an existing file and use saveas command. Example:
    e file
    " echoes /path/to/file
    ruby puts $curbuf.name
    sav file2
    " echoes /path/to/file2
    ruby puts $curbuf.name
    qa!
Buffer number will not change in these cases.
PS: Gentoo linux, amd64, vim version 7.3, ruby 1.8.7_p249: $curbuf.number 
returns correct value.
Текст сообщения: