Class: Victor::CLI::Commands::Convert

Inherits:
Base
  • Object
show all
Defined in:
lib/victor/cli/commands/convert.rb

Instance Method Summary collapse

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/victor/cli/commands/convert.rb', line 20

def run
  svg_data = File.read(args["SVG_FILE"])
  svg_source = SVGSource.new svg_data, template: args['--template']

  code = svg_source.ruby_code
  ruby_file = args["RUBY_FILE"]

  if ruby_file
    File.write ruby_file, code
    say "Saved #{ruby_file}"
  else
    puts code
  end
end