什么'$。' (美元点)在Ruby中意味着什么?

时间:2017-08-03 22:59:41

标签: ruby

我做了$..class并且它显示它是一个Fixnum,但我不确定该值是如何导出的。这是片段的一部分

csv_files.each do |csv_file|
  method, year, currency_col = nil, nil, nil

  CSV.foreach(csv_file, headers: true) do |row|

    if $. == 2
      method_col, year_col, currency_col = "Method", "Year", "Correct Currency"
      method_col2, year_col2             = "Quotation Method", "Fiscal Year"
      validate_headers(csv_file, row, [method_col, year_col, currency_col], [method_col2, year_col2, currency_col])

      method = row[method_col] || row[method_col2]
      year   = row[year_col]   || row[year_col2]
    end