class Victor::CLI::Commands::Convert
Public Instance Methods
run()
click to toggle source
# File lib/victor/cli/commands/convert.rb, line 20 def run svg_file = args["SVG_FILE"] template = args['--template'] svg_node = SVGNode.load_file svg_file, layout: template validate_template template if template code = svg_node.render ruby_file = args["RUBY_FILE"] if ruby_file File.write ruby_file, code say "Saved #{ruby_file}" else puts code end end
validate_template(template)
click to toggle source
# File lib/victor/cli/commands/convert.rb, line 38 def validate_template(template) allowed = %w[cli dsl standalone] unless allowed.include? template raise "Template not found #{template}\nAvailable templates: #{allowed.join ', '}" end end