Execute Ruby script over HTTP protocol as Java Script

S

Speed Knownas

Hi All,

Am a newbie to this Ruby forum. I need a strong help from you people
since i am not well experienced in Ruby.

I need to execute Ruby script on internet (web pages). Is it possible to
execute the ruby code over internet webpages? If not please let me know
the possibilities for it and explain me.

Also please let me know there are any related books and websites for the
same. So that that would be more useful to me.

Regards,
Karthick
 
M

Mike Stephens

Speed said:
I need to execute Ruby script on internet (web pages).

Just to clarify what you're asking - do you want to put a Ruby program
inside a web page sitting on a browser and get it to do something inside
the browser like Javascript can? Maybe you could say what kind of action
you are thinking the Ruby program/applet would perform.
 
S

Speed Knownas

Hi Mike,

Thank you so much ... Exactly ... What i was thinking is, the Ruby
program should execute its code in the web browser as JavaScript does.
So, how to write a Ruby script for this scenario.

Regards,
Karthick
 
M

Mike Stephens

I'll start the ball rolling by suggesting you don't try and run Ruby but
rather use Ruby to generate javascript. Rails has methods to do this.

It includes the prototype, effects, dragdrop and controls libraries, and
the JavascriptHelper module "wraps Javascript access in pristine Ruby
code so you won't have to switch to another language" (I'm quoting
"Agile Web Development with Rails")
 
S

Speed Alert

Thank you Mike ...




Mike said:
I'll start the ball rolling by suggesting you don't try and run Ruby but
rather use Ruby to generate javascript. Rails has methods to do this.

It includes the prototype, effects, dragdrop and controls libraries, and
the JavascriptHelper module "wraps Javascript access in pristine Ruby
code so you won't have to switch to another language" (I'm quoting
"Agile Web Development with Rails")
 
A

Alex

[Note: parts of this message were removed to make it a legal post.]

Thank you Mike ...


If you really insist on writing Ruby to execute in the browser, you could
always use HotRuby: http://hotruby.yukoba.jp/

More than likely though, that's approaching your problem the wrong way, and
you should listen to Mike


Alex
 
S

Speed Alert

Hi Alex,

Thank for your reply. But i am new to Ruby world. I need to start from
the scratch. So, could u please suggest me where to start and how to
start in this regard.

Regards,
Karthick
 
M

Mark Thomas

Hi Mike,

Thank you so much ... Exactly ... What i was thinking is, the Ruby
program should execute its code in the web browser as JavaScript does.
So, how to write a Ruby script for this scenario.

I would suggest Yahoo's BrowserPlus (http://browserplus.yahoo.com/)
which allows you to embed a Ruby interpreter in the browser and
execute Ruby code. There is ample documentation, sample code, and
helpful forums.
 
B

botp

[Note: parts of this message were removed to make it a legal post.]

I would suggest Yahoo's BrowserPlus (http://browserplus.yahoo.com/)
which allows you to embed a Ruby interpreter in the browser and
execute Ruby code. There is ample documentation, sample code, and
helpful forums.

am now a fan of yahoo after noticing that browserplus services are written
in ruby (http://browserplus.yahoo.com/demos/photodrop/intro).
sad though that browserplus runs only on windows and mac :(
 
7

7stud --

Speed said:
Hi Alex,

Thank for your reply. But i am new to Ruby world. I need to start from
the scratch. So, could u please suggest me where to start and how to
start in this regard.

Regards,
Karthick

Generally, you can't do what you want. You can download a browser onto
your computer that is rigged to execute ruby, but a random person that
goes to your website will not be able to execute ruby code in their
browser.

If you want to execute code in most people's browsers, then your web
page needs to employ javascript. In other words, ruby is the wrong
language.

An alternative is to learn ruby and then learn ruby on rails, which will
allow you to dynamically add javascript to your web pages using ruby on
rails, but that is a long ways to go about it. Just learning javascript
is much simpler.
 
E

Eleanor McHugh

Generally, you can't do what you want. You can download a browser
onto
your computer that is rigged to execute ruby, but a random person that
goes to your website will not be able to execute ruby code in their
browser.

That's not strictly speaking true:

HotRuby provides a YARV implementation in JavaScript and Red (http://wonderfullyflawed.com/2008/10/13/red-40-a-full-ruby-runtime-in-your-browser/
) allows you to write your code in Ruby and if I remember rightly then
convert it to JavaScript.


Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net
 
M

Mike Stephens

Just learning javascript
is much simpler.

I think this goes back to my first question : What actual task is trying
to be done?

Avoid choosing a technology for its own sake

If Karthick wants to learn Ruby then targeting the browser is not a good
place to start. If he wants some browser functionality then Javascript
libraries are much more promising ground. If on the other hand he wants
to use the workstation resources for something subtle, then maybe he
should look at using Ruby outside of a browser, or look at something
like Flex or Silverlight.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top