vendor/bundle/ruby/1.8/gems/inifile-1.1.0/lib/inifile.rb
# Parse the ini file contents.
#
Parse the ini file contents.
Parse the ini file contents .
def parse
    return unless File.file?(@fn)
    @_current_section = nil
    @_current_param = nil
    @_current_value = nil
    fd = (RUBY_VERSION >= '1.9' && @encoding) ?
         File.open(@fn, 'r', :encoding => @encoding) :
         File.open(@fn, 'r')
    while line = fd.gets
      line = line.chomp
      if line =~ @rgxp_comment
        finish_property
        next
      end
      if line =~ @rgxp_section
        finish_property
        @_current_section = @ini[$1.strip]
        next
      end
      parse_property line
    end  
    finish_property
  ensure
    fd.close if defined? fd and fd
    @_current_section = nil
    @_current_param = nil
    @_current_value = nil
  end
def parse return unless File . file? ( @fn ) @_current_section = nil @_current_param = nil @_current_value = nil fd = ( RUBY_VERSION >= '1.9' && @encoding ) ? File . open ( @fn , 'r' , :encoding => @encoding ) : File . open ( @fn , 'r' ) while line = fd . gets line = line . chomp if line =~ @rgxp_comment finish_property next end if line =~ @rgxp_section finish_property @_current_section = @ini [ $1 . strip ] next end parse_property line end finish_property ensure fd . close if defined? fd and fd @_current_section = nil @_current_param = nil @_current_value = nil end
Parse the ini file contents.
Parse the ini file contents .
# we ignore comment lines and blank lines # place values in the current section # while