Execute Ruby script over HTTP protocol as Java Script

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

···

--
Posted via http://www.ruby-forum.com/.

Speed Knownas wrote:

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.

···

--
Posted via http://www.ruby-forum.com/.

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

Mike Stephens wrote:

···

Speed Knownas wrote:

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.

--
Posted via http://www.ruby-forum.com/.

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")

···

--
Posted via http://www.ruby-forum.com/.

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.

···

On Jun 23, 5:23 am, Speed Knownas <karthick1...@gmail.com> wrote:

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.

Thank you Mike ...

Mike Stephens wrote:

···

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")

--
Posted via http://www.ruby-forum.com/.

in ruby (http://browserplus.yahoo.com/demos/photodrop/intro).
sad though that browserplus runs only on windows and mac :frowning:

···

On Thu, Jun 25, 2009 at 9:55 AM, Mark Thomas <mark@thomaszone.com> wrote:

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

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

···

On Tue, Jun 23, 2009 at 8:19 AM, Speed Alert <karthick1983@gmail.com> wrote:

Thank you Mike ...

Mike Stephens wrote:
> 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")

--
Posted via http://www.ruby-forum.com/.

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

Alex wrote:

···

On Tue, Jun 23, 2009 at 8:19 AM, Speed Alert <karthick1983@gmail.com> > wrote:

> 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")

--
Posted via http://www.ruby-forum.com/.

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

--
Posted via http://www.ruby-forum.com/.

Speed Alert wrote:

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.

···

--
Posted via http://www.ruby-forum.com/.

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

···

On 25 Jun 2009, at 05:59, 7stud -- wrote:

Speed Alert wrote:

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.

----
raise ArgumentError unless @reality.responds_to? :reason

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.

···

--
Posted via http://www.ruby-forum.com/.

Thank you Ellie ... I will try it and i let you know.

Karthick

Eleanor McHugh wrote:

···

On 25 Jun 2009, at 05:59, 7stud -- wrote:

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
----
raise ArgumentError unless @reality.responds_to? :reason

--
Posted via http://www.ruby-forum.com/.