Skip to content

Instantly share code, notes, and snippets.

View jashkenas's full-sized avatar

Jeremy Ashkenas jashkenas

View GitHub Profile
Index: core/src/processing/core/PApplet.java
===================================================================
--- core/src/processing/core/PApplet.java (revision 5371)
+++ core/src/processing/core/PApplet.java (working copy)
@@ -1386,7 +1386,22 @@
} catch (RendererChangeException e) {
// Give up, instead set the new renderer and re-attempt setup()
return;
+
+ // Catch a JRuby exception so that the RendererChangeExceptions
// API maybes for a ZenItem#toParams()
// If no fields are specified, then the result is a ZenItem#toObject()
// If fields are specified, then we either call the method, or do a get() for the property
// if no method of that name exists on the object.
// If {safe : false} is passed, any of the results that are SafeStrings will be unsafe'd.
UNSAFE_PARAM_MATCHER : (/([^!]+)(!?)/)
/**
* Convert this object into a params hash. Useful for rendering templates
* from the model data and for converting the item into server-ready params.
* Pass in a list of fields, which will be mapped to the results of their
* method (if a method of that name exists) or properties otherwise. If you
* append '!' to the field name, you'll get the SafeString#unsafe() version.
# PROBLEMATIC:
try {
eventMethod = parent.getClass().getMethod("netEvent", new Class[] {
HTMLRequest.class }
);
}
catch (Exception e) {
//System.out.println("Hmmm, event method no go?");
}
View Constructor:
this.configure(options);
this._reset();
this.render();
Base View
.el - conventional root element reference for every view
.toElement - returns this.el
.childViews - Array of child views
Exception in thread "AWT-EventQueue-0" :1: library `java' could not be loaded: java.lang.ClassNotFoundException: org.jruby.javasupport.Java (LoadError)
...internal jruby stack elided...
from (unknown).(unknown)(:1)
final RubyInstanceConfig config = new RubyInstanceConfig() {{
// Fill in with config.
}};
_ruby = Ruby.newInstance(config);
Exception in thread "AWT-EventQueue-0" file:/Users/jashkenas/Documents/Processing/tools/RubyProcessingPlugin/tool/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/builtin/java/ast.rb:1: cannot load Java class org.jruby.ast.Node (NameError)
from file:/Users/jashkenas/Documents/Processing/tools/RubyProcessingPlugin/tool/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/builtin/java/ast.rb:49:in `require'
from file:/Users/jashkenas/Documents/Processing/tools/RubyProcessingPlugin/tool/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/builtin/javasupport.rb:49
from file:/Users/jashkenas/Documents/Processing/tools/RubyProcessingPlugin/tool/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/builtin/javasupport.rb:1
...internal jruby stack elided...
from (unknown).(unknown)(file:/Users/jashkenas/Documents/Processing/tools/RubyProcessingPlugin/tool/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/builtin/java/ast.rb:49)
from Kernel.require(file:/U
URL[] urlList = new URL[archives.length];
for (int j = 0; j < urlList.length; j++) {
urlList[j] = archives[j].toURL();
}
URLClassLoader loader = new URLClassLoader(urlList);
String className = null;
for (int j = 0; j < archives.length; j++) {
className = findClassInZipFile(folders[i].getName(), archives[j]);
if (className != null) break;
file:/Users/jashkenas/Documents/Processing/tools/RubyProcessingPlugin/tool/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8
file:/Users/jashkenas/Documents/Processing/tools/RubyProcessingPlugin/tool/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby
file:/Users/jashkenas/Documents/Processing/tools/RubyProcessingPlugin/tool/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/1.8
file:/Users/jashkenas/Documents/Processing/tools/RubyProcessingPlugin/tool/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/1.8/java
lib/ruby/1.8