0

Is it possible to call a ruby method inside javascript? One way of implementing it is via ajax calls, but is there a way I can embed that ruby function inside the js file and call it just like calling any other js function?

1
  • Yes. If you're viewing with a browser containing an embedded Ruby runtime. Commented May 5, 2010 at 5:31

4 Answers 4

2

I think you want something like RubyJS. This is a port of Google Web Toolkit to Ruby. Essentially it will let you write Ruby code that is compiled into JavaScript then run in the browser.

Sign up to request clarification or add additional context in comments.

Comments

1

No. Not without using Silverlight Dynamic Languages (or similar plugin) to act as a vessel for the language.

Even then, it's not embedding into JS, it's just adding another possible language to the <script> tag.

Comments

1

Assuming you want the JavaScript to run in a web browser: No. Browsers don't have Ruby engines built in.

Comments

0

For Rubyt there was http://hotruby.yukoba.jp/ but it seems like the project stalled.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.