module Processing

The top-level namespace, a home for all Ruby-Processing classes.

More processing module

Constants

BARE_WRAP

For use with “bare” sketches that don't want to define a class or methods

CONFIG_FILE_PATH
NAKED_WRAP
RP_CONFIG

Public Class Methods

load_and_run_sketch() click to toggle source
# File lib/ruby-processing/runners/base.rb, line 34
def self.load_and_run_sketch
  source = read_sketch_source
  wrapped = !source.match(/^[^#]*< Processing::App/).nil?
  no_methods = source.match(/^[^#]*(def\s+setup|def\s+draw)/).nil?
  if wrapped
    run_app
    return
  end
  code = no_methods ? format(NAKED_WRAP, source) : format(BARE_WRAP, source)
  Object.class_eval(code, SKETCH_PATH, -1)
  Processing::App.sketch_class.new
end
read_sketch_source() click to toggle source

Read in the sketch source code. Needs to work both online and offline.

# File lib/ruby-processing/runners/base.rb, line 48
def self.read_sketch_source
  File.read(SKETCH_PATH)
end
run_app() click to toggle source

This method is the common entry point to run a sketch, bare or complete.

# File lib/ruby-processing/runners/base.rb, line 29
def self.run_app
    load SKETCH_PATH
    Processing::App.sketch_class.new unless $app
end