Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# little hack to help setting up test repos for my experiments
# SETUP gem install thor
require 'thor'
class Gitter < Thor
include Thor::Actions
REPO = "orig-repo"
UNIREPO = "uni-repo"
## jruby-users question "Overriding A Method For A Specific Instance" -
####### See: http://markmail.org/thread/emm5h6psqi4z3leq
##
#### Start this with jruby -rgdx.jar gdx_listener_hack.rb
###
#### where gdx is coming from http://libgdx.badlogicgames.com/releases/libgdx-1.0.1.zip
java_import "com.badlogic.gdx.scenes.scene2d.InputListener"
############### from email:
@inger
inger / AbstractRunnable.java
Created April 7, 2010 23:53
Runtime error "Java wrapper with no contents", when subclassing a Runnable class in jruby 1.5 and calling a block. 1.4 works fine.
package bug;
public abstract class AbstractRunnable implements Runnable {
public void run() {
System.out.println("calling into ruby:");
doRun();
System.out.println("calling into ruby: finished");
}
protected abstract void doRun();
}
@inger
inger / Food.java
Created April 4, 2010 23:49
bug in Jruby 1.2 when populating RubyArray in Java
package bug;
import java.util.List;
public class Food {
public final String name;
public final int amount;
public Food(String name, int amount) {
this.name = name;
this.amount = amount;
class A
def f(x = :default)
warn "#{self.class} super f(#{x})"
x
end
end
class B < A
define_method :f do |x|
super