Class: Processing::ClassSketch
- Defined in:
- lib/jruby_art/creators/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
211 212 213 |
# File 'lib/jruby_art/creators/creator.rb', line 211 def class_template format(CLASS_BASIC, @name, @title, @width, @height) end |
#class_template_mode ⇒ Object
215 216 217 |
# File 'lib/jruby_art/creators/creator.rb', line 215 def class_template_mode format(CLASS_MODE, @name, @title, @width, @height, @mode) end |
#create!(path, args) ⇒ Object
Create a class wrapped sketch, given a path.
219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/jruby_art/creators/creator.rb', line 219 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 = StringExtra.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 |