Class: Glossarist::Agent::Iho::BilingualTable
- Inherits:
-
Object
- Object
- Glossarist::Agent::Iho::BilingualTable
- Defined in:
- lib/glossarist/agent/iho/bilingual_table.rb
Instance Attribute Summary collapse
-
#concepts_eng ⇒ Object
Returns the value of attribute concepts_eng.
-
#concepts_other ⇒ Object
Returns the value of attribute concepts_other.
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#lang_code ⇒ Object
Returns the value of attribute lang_code.
-
#rows ⇒ Object
Returns the value of attribute rows.
Instance Method Summary collapse
-
#initialize(file_path:, lang_code:) ⇒ BilingualTable
constructor
A new instance of BilingualTable.
- #process ⇒ Object
Constructor Details
#initialize(file_path:, lang_code:) ⇒ BilingualTable
Returns a new instance of BilingualTable.
31 32 33 34 |
# File 'lib/glossarist/agent/iho/bilingual_table.rb', line 31 def initialize(file_path:, lang_code:) @file_path = file_path @lang_code = lang_code end |
Instance Attribute Details
#concepts_eng ⇒ Object
Returns the value of attribute concepts_eng.
29 30 31 |
# File 'lib/glossarist/agent/iho/bilingual_table.rb', line 29 def concepts_eng @concepts_eng end |
#concepts_other ⇒ Object
Returns the value of attribute concepts_other.
29 30 31 |
# File 'lib/glossarist/agent/iho/bilingual_table.rb', line 29 def concepts_other @concepts_other end |
#file_path ⇒ Object
Returns the value of attribute file_path.
29 30 31 |
# File 'lib/glossarist/agent/iho/bilingual_table.rb', line 29 def file_path @file_path end |
#lang_code ⇒ Object
Returns the value of attribute lang_code.
29 30 31 |
# File 'lib/glossarist/agent/iho/bilingual_table.rb', line 29 def lang_code @lang_code end |
#rows ⇒ Object
Returns the value of attribute rows.
29 30 31 |
# File 'lib/glossarist/agent/iho/bilingual_table.rb', line 29 def rows @rows end |
Instance Method Details
#process ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/glossarist/agent/iho/bilingual_table.rb', line 36 def process # @rows = [] @rows = BilingualRow.from_csv(IO.read(@file_path))[1..-1] @concepts_eng = @rows.map do |bilingual_row| SimpleConcept.new( lang_code: :eng, id: bilingual_row.eng_id.strip, term: bilingual_row.eng_term.strip, definition: bilingual_row.eng_definition.strip, ) end @concepts_other = @rows.map do |bilingual_row| SimpleConcept.new( lang_code: lang_code, id: bilingual_row.other_id.strip, term: bilingual_row.other_term.strip, definition: bilingual_row.other_definition.strip, ) end end |