K
Kevin Howe
Hi all,
I've just released LXL (Like Excel) 0.1.0, a mini-language that mimics
Microsoft Excel formulas. It can be easily extended with new constants and
functions.
http://www.rubyforge.org/projects/lxl/
Install
-------
gem install lxl
Usage
-----
formulas = %{
((1+2)*(10-6))/2;
DATETIME("2004-11-22 11:11:00")=DATE(2004,11,22)+TIME(11,11,00);
IN(" is ", "this is a string");
LIST(1, "two", 3.0);
IN("b", LIST("a", "b", "c"));
AND(TRUE, NULL);
OR(TRUE, FALSE);
IF(1+1=2, "yes", "no");
}
# single formula
puts LXL.eval('5+5').inspect
# => 10
# multiple formulas separated by semi-colon
puts LXL.eval(formulas).inspect
# => [6, true, true, [1, "two", 3.0], true, false, true, "yes"]
See API docs for more information.
Regards,
Kevin
I've just released LXL (Like Excel) 0.1.0, a mini-language that mimics
Microsoft Excel formulas. It can be easily extended with new constants and
functions.
http://www.rubyforge.org/projects/lxl/
Install
-------
gem install lxl
Usage
-----
formulas = %{
((1+2)*(10-6))/2;
DATETIME("2004-11-22 11:11:00")=DATE(2004,11,22)+TIME(11,11,00);
IN(" is ", "this is a string");
LIST(1, "two", 3.0);
IN("b", LIST("a", "b", "c"));
AND(TRUE, NULL);
OR(TRUE, FALSE);
IF(1+1=2, "yes", "no");
}
# single formula
puts LXL.eval('5+5').inspect
# => 10
# multiple formulas separated by semi-colon
puts LXL.eval(formulas).inspect
# => [6, true, true, [1, "two", 3.0], true, false, true, "yes"]
See API docs for more information.
Regards,
Kevin