Code Monkey home page Code Monkey logo

Comments (1)

thatcher avatar thatcher commented on July 20, 2024

Thanks!

Sent from my iPhone
Christopher Thatcher
202-340-9685
[email protected]

On May 11, 2011, at 7:05 AM, [email protected] wrote:

Hello,

With this little script :

puts " ARGV_0 <#{ARGV.join(", ")}> (#{ARGV.class})"
["foo",2,3,4].each{|p| ARGV.push p}
puts " ARGV_1 <#{ARGV.join(", ")}> (#{ARGV.class})"
begin
puts " $FILENAME <#{$FILENAME}> (#{$FILENAME.class})"
rescue => ex
puts " *** EXCEPTION <#{ex.message}>\n STACK=<#{ex.backtrace.join("\n")}>"
end
puts " ARGV_2 <#{ARGV.join(", ")}> (#{ARGV.class})"

If you start it with Ruby 1.8 you will have :
ARGV_0 <> (Array)
ARGV_1 <foo, 2, 3, 4> (Array)
$FILENAME <-> (String)
ARGV_2 <foo, 2, 3, 4> (Array)
which is right and works with 'bin/envjs rubyracer foo.js' as written in the last line of 'envjs/rubyracer.rb'.

but if you try it with Ruby 1.9 you will have :
ARGV_0 <> (Array)
ARGV_1 <foo, 2, 3, 4> (Array)
*** EXCEPTION <No such file or directory - foo>
STACK=<./this_script.rb:XX:in `

'>
ARGV_2 <2, 3, 4> (Array)
which does not work with 'bin/envjs rubyracer foo.js' as written in the last line of 'envjs/rubyracer.rb'.

I suggest to ignore the global variable '$FILENAME'
Probably you have that problem with all JavaScript engines and Ruby.

Regards.

Reply to this email directly or view it on GitHub:
#34

from env-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.