The Ruby Racer (Interview)

Topics covered
Popular Clips
Episode Highlights
Safe Evaluation
The Ruby Racer offers a secure way to evaluate JavaScript within Ruby applications, ensuring that developers can use JavaScript without compromising security. explains that when a JavaScript context is instantiated in Ruby Racer, it only includes standard JavaScript objects, preventing unintended Ruby code execution unless explicitly allowed 1. This setup is crucial for safely evaluating untrusted code, similar to how browsers operate. Lowell highlights its utility in creating APIs that allow users to extend functionality in unforeseen ways, such as using JavaScript to modify images on a server 1.
It allows you to provide an API that allows users of that API to extend it and use it in ways that you had not foreseen.
---
This capability enables sophisticated API logic, enhancing the flexibility and power of server-side JavaScript execution.
  Â
Ruby Racer vs Rhino
Ruby Racer and Ruby Rhino both serve as bridges for embedding JavaScript in Ruby, but they have distinct differences. notes that Ruby Racer is based on the V8 JavaScript engine, while Ruby Rhino uses the Mozilla Rhino engine 2. The primary distinction lies in their threading capabilities; V8 requires a global interpreter lock, similar to Ruby and Python, whereas Rhino supports multi-threading, making it more suitable for multi-threaded applications 2. This threading difference is significant for developers choosing between the two for their specific application needs.
The main difference from my perspective, obviously, one being written in C and the other in Java, is that probably the most important, most important is that the V8 is not multi-threaded.
---
These differences highlight the importance of selecting the right tool based on the application's requirements and the desired integration with JavaScript.
Related Episodes


RubyGems and RubyGems.org (Interview)
Answers 383 questions

Ruby, Rails, the Cloud (Interview)
Answers 383 questions

Ruby, TextMate, Red Dirt Ruby Conf (Interview)
Answers 383 questions

API Wrappers and Ruby (Interview)
Answers 383 questions

Discourse and Ruby (Interview)
Answers 383 questions

RVM and Ruby Version Managment (Interview)
Answers 383 questions

News Roundup (Interview)
Answers 383 questions

Django Dash, Python, Ruby (Interview)
Answers 383 questions

Pair Programming and Ruby (Interview)
Answers 383 questions

CocoaPods and MacRuby (Interview)
Answers 383 questions

Ruby Motion and MacRuby (Interview)
Answers 383 questions

All Things Ruby with 2015's Ruby Heroes (Interview)
Answers 383 questions

Sidekiq and Ruby (Interview)
Answers 383 questions

Ruby Tooling, chruby, ruby-install, Security (Interview)
Answers 383 questions

10+ Years of Rails (Interview)
Answers 383 questions
