Method: Processing::BasicSketch#create!

Defined in:
lib/ruby-processing/exporters/creator.rb

#create!(path, args) ⇒ Object



109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/ruby-processing/exporters/creator.rb', line 109

def create!(path, args)
  return usage if /\?/ =~ path || /--help/ =~ path
  # Check to make sure that the main file doesn't exist already
  already_exist(path)
  main_file = File.basename(path, '.rb') # allow uneeded extension input
  writer = SketchWriter.new(main_file)
  @width = args[0]
  @height = args[1]
  @mode = args[2].upcase unless args[2].nil?
  template = @mode.nil? ? basic_template : basic_template_mode
  writer.save(template)
end