lib/gattica/data_set.rb
# Returns a string formatted as a CSV containing just the data points.
#
# == Parameters:
# +format=:long+::    Adds id, updated, title to output columns
Returns a string formatted as a CSV containing just the data points.
Parameters:
+format=:long+::    Adds id, updated, title to output columns
Returns a string formatted as a CSV containing just the data points . Parameters : + format = : long + :: Adds id updated title to output columns
def to_csv(format=:short)
      output = ''
      columns = []
      case format
        when :long
          ['id', 'updated', 'title'].each { |c| columns << c }
      end
      unless @points.empty?   
        @points.first.map {|d| columns << d.keys }
      end
      output = CSV.generate_line(columns) 
      @points.each do |point|
        output += point.to_csv(format)
      end
      output
    end
def to_csv ( format = :short ) output = '' columns = [ ] case format when :long [ 'id' , 'updated' , 'title' ] . each { | c | columns << c } end unless @points . empty? @points . first . map { | d | columns << d . keys } end output = CSV . generate_line ( columns ) @points . each do | point | output += point . to_csv ( format ) end output end
Returns a string formatted as a CSV containing just the data points.
Returns a string formatted as a CSV containing just the data points .
# if there was at least one result
format
<not_specific>