fh = <<EOF
america
american
april
...
EOF

This will likely add parsing overhead to the script: if you're a performance freak (or would just like a better way), take a tip from how perl hackers do this and use the __END__ method, described here:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/9555

I /was/ trying to avoid parsing overhead, otherwise I would have just thrown the data into an array or a string as described in responses. The __END__ trick is pretty neat, and will certainly solve the problem for now (Thanks!).

However, I do imagine replacing this flat-file database with something pre-indexed and more quickly searchable (like bdb and friends) in the future. Hence, it makes sense to keep this as a non-source "data" file. So, this won't fix my problem forever.

I'll keep an eye on rubygems and when they proclaim a solution to the "datadir problem", I will use that. Until then, I will use this neat __END__ hack.

Thanks,

--
Caleb Phillips
_______________________________________________
PDXRuby mailing list
[email protected]
IRC: #pdx.rb on irc.freenode.net
http://lists.pdxruby.org/mailman/listinfo/pdxruby

Reply via email to