aboutsummaryrefslogtreecommitdiff
path: root/lib/csv_exporter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/csv_exporter.rb')
-rw-r--r--lib/csv_exporter.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/csv_exporter.rb b/lib/csv_exporter.rb
index a44815d..0463ba6 100644
--- a/lib/csv_exporter.rb
+++ b/lib/csv_exporter.rb
@@ -12,10 +12,18 @@ class CsvExporter < BaseExporter
str
end
+ protected
+
+ # Generate a new CSV line from the given `thing`.
def thing_to_csv(thing:)
- CSV.generate_line([thing.target, thing.authors, thing.editors, thing.year, thing.title,
- thing.note, thing.insideof, thing.url, thing.publisher, thing.kind,
- thing.access, thing.bought_at],
+ CSV.generate_line([thing.target, thing.authors, thing.editors, thing.year,
+ clean_title(title: thing.title), thing.note, thing.insideof,
+ thing.url, thing.publisher, thing.kind, thing.access, thing.bought_at],
quote_empty: false)
end
+
+ # Clean the given title from underscores and other such characters.
+ def clean_title(title:)
+ title.delete('_')
+ end
end