I needed a little script to read data out of windows-style .ini files. Searching my windows machine I found inifile.rb in this path:
C:\ruby\lib\ruby\site_ruby\1.8\vr\contrib\
it seems unnatural to add this path directly to my rubylib path as this will mean any other special units I want will need to be added.
so in my code I wrote this:
require 'vr/contrib/inifile'
ini = Inifile.new("file.ini")
puts ini.read("common","name","defaul开发者_如何转开发t name")
This worked, but also doesn't seem elegant for inclusion. There must be a better way to specify this in the code ?
I think inifile.rb is part of vruby, which, it appears, is "a GUI library on MS Windows for Ruby". Which is something I'd never come across, so thanks!
It looks like that path is going to be necessary unless you either add it to your main Windows PATH (possible overkill) or to your Ruby load path, which you can access via the slightly arcane $:
I hope that , if only perhaps a little...
精彩评论