Parent

Class/Module Index [+]

Quicksearch

Statsample::SpreadsheetBase

Public Class Methods

convert_to_scale_and_date(ds,fields) click to toggle source
# File lib/statsample/converters.rb, line 109
def convert_to_scale_and_date(ds,fields)
  fields.each do |f|
    if ds[f].can_be_scale?
      ds[f].type=:scale
    elsif ds[f].can_be_date?
      ds[f].type=:date
    end
  end
end
extract_fields(row) click to toggle source
# File lib/statsample/converters.rb, line 79
def extract_fields(row)
  i=0;
  fields=row.to_a.collect{|c|
    if c.nil?
      i+=1
      "var%05d" % i 
    else
      c.to_s.downcase
    end        
  }
  fields.recode_repeated
end
process_row(row,empty) click to toggle source
# File lib/statsample/converters.rb, line 92
def process_row(row,empty)
  row.to_a.map do |c|
    if empty.include?(c)
        nil
    else
      if c.is_a? String and c.is_number?
        if c=~/^\d+$/
          c.to_i
        else
          c.gsub(",",".").to_f
        end
      else
        c
      end
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.