Home Download Buy Blog Forum Support

Run Selection as Ruby Code?

Run Selection as Ruby Code?

Postby canadaduane on Mon Jan 30, 2012 8:04 pm

I've searched around for this, but have so far come up dry. Is there a way to run the currently selected text through a ruby interpreter and replace with the result?
canadaduane
 
Posts: 14
Joined: Wed Aug 31, 2011 3:22 pm

Re: Run Selection as Ruby Code?

Postby canadaduane on Mon Jan 30, 2012 9:34 pm

I see from the Build System documentation [1] that it's possible to use any executable or shell script to "build" your project or file. I thought this might be a solution, but it doesn't appear to allow for piping selected text through to the shell. It does allow for the whole file, however:

Code: Select all
{
    "cmd": ["python", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}


[1] http://sublimetext.info/docs/en/referen ... stems.html
canadaduane
 
Posts: 14
Joined: Wed Aug 31, 2011 3:22 pm

Re: Run Selection as Ruby Code?

Postby canadaduane on Tue Jan 31, 2012 2:44 pm

I'm still searching for an answer, but for others who may find this post later:

Darin Morrison has created a python version of what I'm looking for and hosts it at github [1]. I wonder if it would be easy to modify it to execute selected text inside a Ruby interpreter instead...

[1] viewtopic.php?f=5&t=4494
canadaduane
 
Posts: 14
Joined: Wed Aug 31, 2011 3:22 pm

Re: Run Selection as Ruby Code?

Postby ralphschindler on Wed Mar 07, 2012 5:20 pm

I've done for PHP, you can tailor to your needs.

https://github.com/ralphschindler/Sublime-PHP-Extras

-ralph
ralphschindler
 
Posts: 2
Joined: Wed Mar 07, 2012 5:03 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 16 guests