Module: SycLink::Exporter

Included in:
Website
Defined in:
lib/syclink/exporter.rb

Overview

Methods to export data into specific formats

Instance Method Summary collapse

Instance Method Details

#to_csvObject

Takes an array of row values and converts them to a csv string. Expects that the importing class is having a method rows.



17
18
19
# File 'lib/syclink/exporter.rb', line 17

def to_csv
  rows.map { |row| row.join(';') }.join("\n")
end

#to_html(template) ⇒ Object

Creates an html file based on an erb template



10
11
12
13
# File 'lib/syclink/exporter.rb', line 10

def to_html(template)
  renderer = ERB.new(template)
  renderer.result(binding)
end