[TxMt] Spreadsheets in Textmate
Charilaos Skiadas
cskiadas at uchicago.edu
Sat Apr 22 04:07:59 UTC 2006
On Apr 21, 2006, at 5:19 PM, James Edward Gray II wrote:
> Filter the formulas through Ruby and we gain an instance
> programming language. You could even use const_missing() to spring
> the cell references to life as needed... :D
>
I just updated the bundle (same link), and it now has a lot more ruby
support. First off, you can have it execute one-liners of the form "%
r aRubyCommandHere ". These are executed by a Spreadsheet instance.
You can access the data by calling "data". So "data[4][5]" will
return the entry in E5. To set values, use set_data. so both "set_data
([4,5],28)" and "set_data("E5",28)" will set the value of E5 to 28.
Atm the whole program must be in one line I'm afraid. (currently,
"data["E5"] will unfortunately not return what you would expect.)
The other way is to add to the built in functions. The file
commands.rb contains the module ParserDelegateMethods. This module is
being loaded into ParserDelegate. If you add to this module a command
like:
def foo(array)
dosomethingwitharrayandreturnvalue
end
then in your files you could use FOO(2,3,4) to call this command.
> Just a thought.
>
> James Edward Gray II
Haris
More information about the textmate
mailing list