Index of /~tamura/ruby/ruby-js

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[TXT]README.html.ja12-Mar-2003 00:01 5.1K 
[TXT]README.html12-Mar-2003 00:01 4.2K 
[   ]rubyjs-0.0.4.tar.gz12-Mar-2003 00:00 3.9K 
[   ]rubyjs-0.0.3.tar.gz26-Feb-2003 23:25 3.2K 
[   ]rubyjs-0.0.2.tar.gz25-Feb-2003 02:09 2.8K 
[   ]rubyjs-0.0.4-html.tar.gz12-Mar-2003 00:10 2.7K 
[   ]rubyjs-0.0.3-html.tar.gz26-Feb-2003 23:25 2.1K 

README.rd

Ruby/JS Javascript engine for Ruby

This is Ruby Extension for Using NJS Javascript Interpreter <URL:http://www.bbassett.net/njs/>

current Version(0.0.4) feature this:

% ruby -rjs -e 'p JS::evaluate(%!true!)'
true
% ruby -rjs -e 'p JS::evaluate(%!Math.PI!)'
3.141592654
% ruby -rjs -e 'p JS::evaluate(%q!new Date().toString()!)'
"Mon Feb 24 12:39:15 2003"
% ruby -r./js -e \
   'js = JS.new;p js.eval("a = new Array(5); a.length;"); \
    p js.eval("a.toString()")'
5
"undefined,undefined,undefined,undefined,undefined"
% ruby -r./js -e \
   'js = JS.new;p js.eval(%q!a = new Array("a","b","cc",new Array(1,2,3.1414));!)' 
["a", "b", "cc", [1, 2, 3.1414]]

I reference

Install

Require NJS(tested 0.2.5). and

% ruby extconf.rb
% make
% sudo make install

Reference

JS class

Class Method:

JS.evaluate(code)

eval Javascript code and return value. raise JSError exception when error.

JS.new()

create Javascript Interpreter.

JS#eval(code)

eval code and return value by Interpreter instance. raise JSError exception when error.

Constants:

JS::LIB_VERSION

NJS's Version string return.

JSError class

sub class of StandardError.

Copying

No warranties, GPL2 license. see js.c

ChangeLog

Sat Mar 11 00:00:00 2003

Sat Feb 29 00:00:00 2003

Wed Feb 26 18:00:00 2003

Mon Feb 24 18:00:00 2003

Sun Feb 23 18:00:00 2003

TAMURA.Kenichi tamura@ruby-lang.org