Class: Processing::BasicSketch
- Defined in:
- lib/ruby-processing/exporters/creator.rb
Overview
This class creates bare sketches, with an optional render mode
Constant Summary
Constants inherited from Creator
Instance Method Summary collapse
-
#basic_template ⇒ Object
Create a blank sketch, given a path.
- #basic_template_mode ⇒ Object
- #create!(path, args) ⇒ Object
Methods inherited from Creator
Instance Method Details
#basic_template ⇒ Object
Create a blank sketch, given a path.
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/ruby-processing/exporters/creator.rb', line 64 def basic_template %( def setup size <%=@width%>, <%=@height%> end def draw end ) end |
#basic_template_mode ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/ruby-processing/exporters/creator.rb', line 76 def basic_template_mode %( def setup size <%=@width%>, <%=@height%>, <%=@mode%> end def draw end ) end |
#create!(path, args) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/ruby-processing/exporters/creator.rb', line 88 def create!(path, args) return usage if /\?/ =~ path || /--help/ =~ path main_file = File.basename(path, '.rb') # Check to make sure that the main file doesn't exist already already_exist(path) @param = { name: main_file.camelize, file_name: "#{File.dirname(path)}/#{path.underscore}.rb", title: main_file.titleize, width: args[0], height: args[1], mode: args[2] } @with_size = @param[:width] && @param[:width].match(ALL_DIGITS) && @param[:height] && @param[:height].match(ALL_DIGITS) template = @param[:mode].nil? ? basic_template : basic_template_mode SketchWriter.new(template, @param) end |