Class: MedelaBstAndroidExcel2xml::Converter
- Inherits:
-
Object
- Object
- MedelaBstAndroidExcel2xml::Converter
- Defined in:
- lib/medela_bst_android_excel2xml/converter.rb
Instance Attribute Summary collapse
-
#destination_path ⇒ Object
Returns the value of attribute destination_path.
-
#languages ⇒ Object
Returns the value of attribute languages.
Instance Method Summary collapse
-
#initialize(spreadsheet_path) ⇒ Converter
constructor
A new instance of Converter.
- #run ⇒ Object
Constructor Details
#initialize(spreadsheet_path) ⇒ Converter
Returns a new instance of Converter.
7 8 9 10 11 |
# File 'lib/medela_bst_android_excel2xml/converter.rb', line 7 def initialize(spreadsheet_path) @file = Roo::Spreadsheet.open(spreadsheet_path) @destination_path ||= Dir.pwd @languages ||= [] end |
Instance Attribute Details
#destination_path ⇒ Object
Returns the value of attribute destination_path.
5 6 7 |
# File 'lib/medela_bst_android_excel2xml/converter.rb', line 5 def destination_path @destination_path end |
#languages ⇒ Object
Returns the value of attribute languages.
5 6 7 |
# File 'lib/medela_bst_android_excel2xml/converter.rb', line 5 def languages @languages end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/medela_bst_android_excel2xml/converter.rb', line 13 def run translations = parse_sheet translations.select!(@languages) unless @languages.empty? translations.each do |language, translation_hash| xml = generate_xml(translation_hash) save_xml(xml, language) end end |