Skip to content

Instantly share code, notes, and snippets.

@Stanley
Created March 20, 2009 21:03
Show Gist options
  • Save Stanley/82581 to your computer and use it in GitHub Desktop.
Save Stanley/82581 to your computer and use it in GitHub Desktop.
function irb( input ){
jQuery.ajaxSetup({
async: false
});
var baseUrl = "http://tryruby.hobix.com/irb";
var params = {cmd: "!INIT!IRB!"};
jQuery.get( baseUrl, params);
var params = {cmd: input};
return jQuery.get( baseUrl, params ).responseText.replace(/\n/g, "<br/>");
}
CmdUtils.CreateCommand({
names: ["irb"],
icon: "http://ruby-doc.org/favicon.ico",
homepage: "http://wasiutynski.net/blog",
author: { name: "Stanislaw Wasiutynski", email: "stanislaw@wasiutynski.net"},
license: "GPL",
description: "Interactive Ruby Shell",
help: "Insert your ruby code",
arguments: {role: "object", nountype: noun_arb_text, label: "code"},
preview: function( pblock, input ) {
pblock.innerHTML = irb( input.object.text );
},
execute: function( input ) {
CmdUtils.setSelection( irb( input.object.text ) );
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment