Class: Iev::Exporter
- Inherits:
-
Object
- Object
- Iev::Exporter
- Defined in:
- lib/iev/exporter.rb
Overview
Exports IEV data to Glossarist YAML format.
Automatically detects input format from file extension:
.xlsx / .xls → Excel IEV export
.sqlite3 / .sqlite / .db → SQLite database
Constant Summary collapse
- XLSX_EXTENSIONS =
%w[.xlsx .xls].freeze
- SQLITE_EXTENSIONS =
%w[.sqlite3 .sqlite .db].freeze
Instance Attribute Summary collapse
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
-
#input_path ⇒ Object
readonly
Returns the value of attribute input_path.
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
Instance Method Summary collapse
-
#export ⇒ Glossarist::ManagedConceptCollection
Run the export pipeline: load → transform → save.
-
#initialize(input_path, output_dir: Dir.pwd, only_concepts: nil, only_languages: nil) ⇒ Exporter
constructor
A new instance of Exporter.
Constructor Details
#initialize(input_path, output_dir: Dir.pwd, only_concepts: nil, only_languages: nil) ⇒ Exporter
Returns a new instance of Exporter.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/iev/exporter.rb', line 30 def initialize(input_path, output_dir: Dir.pwd, only_concepts: nil, only_languages: nil) @input_path = Pathname.new(input_path) validate_input! @output_dir = Pathname.new(output_dir) @filters = { only_concepts: only_concepts, only_languages: only_languages, }.compact end |
Instance Attribute Details
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
24 25 26 |
# File 'lib/iev/exporter.rb', line 24 def filters @filters end |
#input_path ⇒ Object (readonly)
Returns the value of attribute input_path.
24 25 26 |
# File 'lib/iev/exporter.rb', line 24 def input_path @input_path end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
24 25 26 |
# File 'lib/iev/exporter.rb', line 24 def output_dir @output_dir end |
Instance Method Details
#export ⇒ Glossarist::ManagedConceptCollection
Run the export pipeline: load → transform → save.
44 45 46 47 48 49 |
# File 'lib/iev/exporter.rb', line 44 def export dataset = load_dataset collection = build_collection(dataset) save_collection(collection) collection end |