I'm giving WebEx because supposedly it's much more Linux friendly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'v8' | |
require 'openssl' | |
class Module | |
def [](name) | |
self.const_get(name) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package spike; | |
import org.jruby.embed.ScriptingContainer; | |
public class Spike { | |
public static void main(String[] args) { | |
ScriptingContainer container = new ScriptingContainer(); | |
Object someInstance = container.runScriptlet("Object.new"); | |
container.callMethod(someInstance, "instance_eval", "self", "<eval>", 1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
legolas:~ cowboyd$ ri Object | |
Nothing known about Object | |
legolas:~ cowboyd$ rvm use system | |
info: Now using system ruby. | |
legolas:~ cowboyd$ ri Object | |
### a whole mess of stuff about object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ruby; | |
import hudson.model.Descriptor; | |
import hudson.slaves.Cloud; | |
@SuppressWarnings({"UnusedDeclaration"}) | |
public abstract class RubyCloudDescriptor extends Descriptor<Cloud> { | |
protected RubyCloudDescriptor() { | |
super(Cloud.class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package spike; | |
import org.jruby.embed.ScriptingContainer; | |
public class Spike { | |
public void inspectClass(Class cls) { | |
System.out.println("java_class: " + cls); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'v8' | |
require 'delegate' | |
cxt = V8::Context.new | |
a = SimpleDelegator.new([17,1]) | |
cxt['a'] = a | |
cxt.eval('a.push(10)') | |
puts a.inspect //=> [17,1,10] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'v8' | |
require 'delegate' | |
cxt = V8::Context.new | |
cxt['puts'] = lambda {|msg| puts(msg)} | |
a = SimpleDelegator.new([17,1]) | |
def a.each(fn) | |
__getobj__.each do |item| | |
fn.call(item) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'v8' | |
require 'delegate' | |
cxt = V8::Context.new | |
cxt['puts'] = lambda {|msg| puts(msg)} | |
a = SimpleDelegator.new([17,1]) | |
def a.each(fn) | |
__getobj__.each do |item| | |
fn.methodcall(item) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'v8' | |
V8::Context.new do |cxt| | |
a = cxt.eval('["fe", "fi", "fo", "fum"]') | |
a.each do |item| | |
puts item | |
end | |
end |