class Processing::ClassSketch

This class creates class wrapped sketches, with an optional render mode

Public Instance Methods

class_template() click to toggle source
# File lib/ruby-processing/exporters/creator.rb, line 125
def class_template
  format(CLASS_BASIC, @name, @width, @height)
end
class_template_mode() click to toggle source
# File lib/ruby-processing/exporters/creator.rb, line 129
def class_template_mode
  format(CLASS_MODE, @name, @width, @height, @mode)
end
create!(path, args) click to toggle source

Create a class wrapped sketch, given a path.

# File lib/ruby-processing/exporters/creator.rb, line 133
def create!(path, args)
  return usage if /\?/ =~ path || /--help/ =~ path
  main_file = File.basename(path, '.rb') # allow uneeded extension input
  # Check to make sure that the main file doesn't exist already
  already_exist(path)
  @name = CamelString.new(main_file).camelize
  writer = SketchWriter.new(main_file)
  @title = StringExtra.new(main_file).titleize
  @width, @height = args[0], args[1]
  @mode = args[2].upcase unless args[2].nil?
  template = @mode.nil? ? class_template : class_template_mode
  writer.save(template)
end