closer changed the topic of #ruby-core to: check the latest release candidate for 1.9.1 release ftp.ruby-lang.org:/home/yugui/ruby-1.9.1-r26021+1.tar.bz2
<zzak>
[gizmore, irc.freenode.net] Is 'The Last Unicorn' for girls only?!
hsbt_away is now known as hsbt
<zzak>
[bazz, irc.freenode.net] is there a "scalable" way to check if a file has a trailing newline?
<zzak>
[gizmore, irc.freenode.net] "\\n no
hsbt is now known as hsbt_away
<zzak>
[nofxx, irc.freenode.net] bazz_, iirc you can read only a few bytes of a file, and offset this to parallelize
<zzak>
[nofxx, irc.freenode.net] but... couldn;t you just delegate that issue to ag? (silver searcher)
<zzak>
[bazz, irc.freenode.net] I think maybe I'm taking the issue too seriously .. i just am dealing with dictionary files in the < 10 MB range .. and it's just a personal project ..
<zzak>
[bazz, irc.freenode.net] need to check if the last byte is a newline .. or must manually append it proper
<zzak>
[bazz, irc.freenode.net] I'll just file File.open and IO seek -1 (will try anyways)
<zzak>
[nofxx, irc.freenode.net] bazz_, yeah... you fallen into the "early optimization root of all evil stuff"
<zzak>
[nofxx, irc.freenode.net] =D
<zzak>
[bazz, irc.freenode.net] yeah and I'm even conscious of premature optimization!! It's hard for me :|
<zzak>
[nofxx, irc.freenode.net] also, if it fits in ram it'll be fast... don't worry
<zzak>
[bazz, irc.freenode.net] ok and furthermore .. is it possible to read and append to file in a single block?
<zzak>
[bazz, irc.freenode.net] sorry, I can RTFM :)
<zzak>
[bazz, irc.freenode.net] `a+` it is
<zzak>
[nofxx, irc.freenode.net] bazz_, guess so... check the options, there's 'r', 'w'... 'r+'... file I/O is something I always need the... you beat me to it
<zzak>
[nofxx, irc.freenode.net] bazz_, yeah, append! if it's always the ending it's perfect for you
<zzak>
[bazz, irc.freenode.net] heh I've been appending ;) -- but if the file does not have a trailing new line, I wind up appending to the last pre-existing line
<zzak>
[nofxx, irc.freenode.net] bazz_, and it doesn't need to be in the same block, if you don't use any block
<zzak>
[nofxx, irc.freenode.net] file will remain open
<zzak>
[nofxx, irc.freenode.net] eg f = File.open(....
<zzak>
[bazz, irc.freenode.net] well a+ will give me read/write block anyways