# File lib/hashery/ini_hash.rb, line 218
    def self.read_from_file(path)
      raise "file not found - #{path}" unless File.file?(path)

      inihash = {}
      headline = nil

      IO.foreach(path) do |line|
        line = line.strip.split(/#/)[0].to_s

        # read it only if the line doesn't begin with a "=" and is long enough
        unless line.length < 2 and line[0,1] == "="
          
          # it's a headline if the line begins with a "[" and ends with a "]"
          if line[0,1] == "[" and line[line.length - 1, line.length] == "]"

            # get rid of the [] and unnecessary spaces
            headline = line[1, line.length - 2 ].strip
            inihash[headline] = {}
          else
            key, value = line.split(/=/, 2)
            
            key = key.strip unless key.nil?
            value = value.strip unless value.nil?
            
            unless headline.nil?
              inihash[headline][key] = value
            else
              inihash[key] = value unless key.nil?
            end
          end        
        end
      end
      
      inihash
    end