Class: Lono::Pro::Importer::Converter

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

Instance Method Summary collapse

Methods included from Download

#download_template, #json?, #read_source

Constructor Details

#initialize(source, options = {}) ⇒ Converter

source is a path



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

def initialize(source, options={})
  @source, @options = source, options
end

Instance Method Details

#runObject



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

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