Class: Chartio::CSVFormatter
- Defined in:
- lib/chartio/csv_formatter.rb
Instance Attribute Summary collapse
-
#foreign_keys ⇒ Object
Returns the value of attribute foreign_keys.
Instance Method Summary collapse
- #foreign_key(incoming_foreign_key) ⇒ Object
-
#initialize ⇒ CSVFormatter
constructor
A new instance of CSVFormatter.
- #output_report ⇒ Object
Methods inherited from Formatter
Constructor Details
#initialize ⇒ CSVFormatter
Returns a new instance of CSVFormatter.
8 9 10 11 12 |
# File 'lib/chartio/csv_formatter.rb', line 8 def initialize @foreign_keys = [] @stringio = StringIO.open @csv = CSV.new(@stringio) end |
Instance Attribute Details
#foreign_keys ⇒ Object
Returns the value of attribute foreign_keys.
6 7 8 |
# File 'lib/chartio/csv_formatter.rb', line 6 def foreign_keys @foreign_keys end |
Instance Method Details
#foreign_key(incoming_foreign_key) ⇒ Object
14 15 16 |
# File 'lib/chartio/csv_formatter.rb', line 14 def foreign_key(incoming_foreign_key) @foreign_keys << incoming_foreign_key end |
#output_report ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/chartio/csv_formatter.rb', line 18 def output_report @csv << Chartio::ForeignKeyRelationship::FIELDS.map(&:to_s) @foreign_keys.each do |key| @csv << key.to_a end @csv.string end |