Module: Processing
- Defined in:
- lib/ruby-processing.rb,
lib/ruby-processing/app.rb,
lib/ruby-processing/config.rb,
lib/ruby-processing/runner.rb,
lib/ruby-processing/runners/base.rb,
lib/ruby-processing/runners/watch.rb,
lib/ruby-processing/helper_methods.rb,
lib/ruby-processing/library_loader.rb,
lib/ruby-processing/exporters/creator.rb,
lib/ruby-processing/exporters/base_exporter.rb,
lib/ruby-processing/exporters/application_exporter.rb
Overview
The top-level namespace, a home for all Ruby-Processing classes.
Defined Under Namespace
Modules: HelperMethods, Proxy Classes: App, ApplicationExporter, BaseExporter, BasicSketch, ClassSketch, Creator, Inner, LibraryLoader, Runner, SketchWriter, Watcher
Constant Summary collapse
- RP_CONFIG =
{ 'PROCESSING_ROOT' => RP5_ROOT, 'JRUBY' => 'false' }
- BARE_TEMPLATE =
For use with “bare” sketches that don’t want to define a class or methods
<<-EOS class Sketch < Processing::App %s end EOS
- NAKED_TEMPLATE =
<<-EOS class Sketch < Processing::App def setup size(DEFAULT_WIDTH, DEFAULT_HEIGHT) %s no_loop end end EOS
Class Method Summary collapse
- .exported? ⇒ Boolean
-
.load_and_run_sketch ⇒ Object
This method is the common entry point to run a sketch, bare or complete.
-
.read_sketch_source ⇒ Object
Read in the sketch source code.
Class Method Details
.exported? ⇒ Boolean
18 19 20 |
# File 'lib/ruby-processing.rb', line 18 def self.exported? @exported ||= ENV['EXPORTED'].eql?('true') end |
.load_and_run_sketch ⇒ Object
This method is the common entry point to run a sketch, bare or complete.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ruby-processing/runners/base.rb', line 28 def self.load_and_run_sketch source = read_sketch_source has_sketch = !source.match(/^[^#]*< Processing::App/).nil? has_methods = !source.match(/^[^#]*(def\s+setup|def\s+draw)/).nil? return load File.join(SKETCH_ROOT, SKETCH_PATH) if has_sketch if has_methods code = format(BARE_TEMPLATE, source) else code = format(NAKED_TEMPLATE, source) end Object.class_eval code, SKETCH_PATH, -1 Processing::App.sketch_class.new end |
.read_sketch_source ⇒ Object
Read in the sketch source code. Needs to work both online and offline.
44 45 46 |
# File 'lib/ruby-processing/runners/base.rb', line 44 def self.read_sketch_source File.read(SKETCH_PATH) end |