Class: Logaling::GlossarySources::GlossaryTsvSource
- Defined in:
- lib/logaling/glossary_sources/glossary_tsv_source.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#absolute_path, #eql?, #hash, #initialize, #mtime
Constructor Details
This class inherits a constructor from Logaling::GlossarySources::Base
Instance Method Details
#load ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/logaling/glossary_sources/glossary_tsv_source.rb', line 23 def load glossary_source = [] CSV.open(absolute_path, "r:utf-8", {:col_sep => "\t"}) do |tsv| tsv.each do |row| glossary_source << {"source_term" => row[0], "target_term" => row[1], "note" => ""} if row.size >= 2 end end glossary_source end |