Method: Hash.file

Defined in:
lib/rwd/ruby.rb

.file(file) ⇒ Object



661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
# File 'lib/rwd/ruby.rb', line 661

def self.file(file)
  res = new

  File.open(file) do |f|
    #f.readlines.chomp.each do |line|
    while line = f.gets do
      line.chomp!

      unless line.empty?
        k, v  = line.split(/\s*=\s*/, 2)
        res[k]  = v
      end
    end
  end

  res
end