lib/logaling/external_glossaries/gnome_project.rb in logaling-command-0.1.1 vs lib/logaling/external_glossaries/gnome_project.rb in logaling-command-0.1.2

- old
+ new

@@ -1,6 +1,7 @@ # Copyright (C) 2011 Miho SUZUKI +# Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. @@ -19,17 +20,16 @@ module Logaling class GnomeProject < ExternalGlossary description 'GNOME Translation Project Ja (http://live.gnome.org/TranslationProjectJa)' source_language 'en' target_language 'ja' + output_format 'csv' - def convert - buffer = "" - CSV.generate(buffer) do |csv| - doc = ::Nokogiri::HTML(open("http://www.gnome.gr.jp/l10n/trans-terms.html", "r")) - doc.css('table tr')[1..-1].each do |tr| - csv << [tr.children[0].text, tr.children[1].text] - end + private + def convert_to_csv(csv) + doc = ::Nokogiri::HTML(open("http://www.gnome.gr.jp/l10n/trans-terms.html", "r")) + doc.css('table tr')[1..-1].each do |tr| + csv << [tr.children[0].text, tr.children[1].text] end end end end