Class: Processing::ClassSketch
- Defined in:
- lib/ruby-processing/exporters/creator.rb
Overview
This class creates class wrapped sketches, with an optional render mode
Constant Summary
Constants inherited from Creator
Processing::Creator::ALL_DIGITS
Instance Method Summary collapse
- #class_template ⇒ Object
- #class_template_mode ⇒ Object
-
#create!(path, args) ⇒ Object
Create a class wrapped sketch, given a path.
Methods inherited from Creator
Instance Method Details
#class_template ⇒ Object
125 126 127 |
# File 'lib/ruby-processing/exporters/creator.rb', line 125 def class_template format(CLASS_BASIC, @name, @width, @height) end |
#class_template_mode ⇒ Object
129 130 131 |
# File 'lib/ruby-processing/exporters/creator.rb', line 129 def class_template_mode format(CLASS_MODE, @name, @width, @height, @mode) end |
#create!(path, args) ⇒ Object
Create a class wrapped sketch, given a path.
133 134 135 136 137 138 139 140 141 142 143 144 145 |
# 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 |