Class: Lono::Importer::Converter

Inherits:
Object
  • Object
show all
Includes:
Download
Defined in:
lib/lono/importer/converter.rb

Instance Method Summary collapse

Methods included from Download

#download_template, #json?, #read_source

Constructor Details

#initialize(options = {}) ⇒ Converter

source is a path



6
7
8
9
# File 'lib/lono/importer/converter.rb', line 6

def initialize(options={})
  @options = options
  @source = options[:source]
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
# File 'lib/lono/importer/converter.rb', line 11

def run
  tmp_path = "/tmp/lono/import/template.yml"
  tmp_template_path = download_template(@source, tmp_path)
  template = IO.read(tmp_template_path)
  coder = Service::Coder.new(template, @options)
  coder.translate
end