Ruby?

G

Gib Let

I am currently in the planning process of making a website, and I have
heard that Ruby is good to use, but I am a little confused as to what
Ruby is. As far as I can tell, it's code that generates XML (I don't
know if I'm right).

I've been reading a few tutorials, and have made no sense of them. What
parts of the website do you use Ruby for? I was presuming HTML was used
for the structure, and Ruby for certain features.

Can anyone shead a little light on it for me?
 
G

Glen Holcomb

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

I am currently in the planning process of making a website, and I have
heard that Ruby is good to use, but I am a little confused as to what
Ruby is. As far as I can tell, it's code that generates XML (I don't
know if I'm right).

I've been reading a few tutorials, and have made no sense of them. What
parts of the website do you use Ruby for? I was presuming HTML was used
for the structure, and Ruby for certain features.

Can anyone shead a little light on it for me?
www.rubyonrails.org
www.nitroproject.org
http://code.whytheluckystiff.net/camping/
http://merbivore.com/
 
A

Aria Stewart

I am currently in the planning process of making a website, and I have
heard that Ruby is good to use, but I am a little confused as to what
Ruby is. As far as I can tell, it's code that generates XML (I don't
know if I'm right).

I've been reading a few tutorials, and have made no sense of them.
What
parts of the website do you use Ruby for? I was presuming HTML was
used
for the structure, and Ruby for certain features.

Can anyone shead a little light on it for me?

Ruby is a general-purpose programming language. It can generate any
data you'd care to; it's not specific to web programming as PHP was
intended, but you can indeed have a process running on the server,
written in ruby, that serves HTML pages, either static or dynamically
generated.
 
F

Florian Gilcher

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am currently in the planning process of making a website, and I have
heard that Ruby is good to use, but I am a little confused as to what
Ruby is. As far as I can tell, it's code that generates XML (I don't
know if I'm right).

I've been reading a few tutorials, and have made no sense of them.
What
parts of the website do you use Ruby for? I was presuming HTML was
used
for the structure, and Ruby for certain features.

Can anyone shead a little light on it for me?

Ruby is a general purpose programming language. It has no specific
task, but you can handle
almost every task with it. No more, no less.

So essentially, you can use Ruby for everything you could use Java/
Python/PHP for. Ruby has
some really nice frameworks for web development, Glen already gave you
the links.

Greetings
Skade
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkfoHMsACgkQJA/zY0IIRZb0PACfTfRhfUfQr3LmQyhO2wqnu/4g
tc8AoKuVQXeeobGJoWfbrciOK0pdtFYD
=ju+J
-----END PGP SIGNATURE-----
 
G

Gib Let

But what type of things would you use Ruby for within a website? And
would you use HTML for example, to create the structure, or is it all
done in Ruby?
 
B

brabuhr

But what type of things would you use Ruby for within a website? And
would you use HTML for example, to create the structure, or is it all
done in Ruby?

Well, it really depends on what your website is intended to do and
what Ruby technology/framework you choose.

For example, in something like Rails the site structure emerges from
the Ruby (controller) classes and the content of the pages would be
built from HTML with embedded Ruby expressions. (Of course, I have
glossed over a lot with this simplistic description.) So, for the
sake of argument, say your website tracks cars and their drivers and
you are using something Rails-like.

You could create the following Ruby controller classes: CarsController
and DriversController
In CarsController, define methods like new and list
Then you could have URLs like
/cars/list
/cars/new
Each method could have a corresponding HTML snippet (new.rhtml and
list.rhtml)
list.rhtml may look like:
<% cars.each do |car| %>
<li><%= car.vin %></li>
<% end %>

http://www.rubyonrails.org/screencasts
 
B

Bill Kelly

From: "Gib Let said:
But what type of things would you use Ruby for within a website? And
would you use HTML for example, to create the structure, or is it all
done in Ruby?

To develop a project of any significant size, you'll probably want to look into
one of the many available ruby web frameworks, as others have mentioned.

However it is also possible to start very simply. Here is a "hello world"
web program in ruby, using the built-in CGI module:

http://billk.tastyspleen.net/cgi-bin/hello-world.cgi

As can be seen from the source code shown on the page, the HTML is
generated dynamically using cgi methods.


Here's a more real world example of using the CGI module. This is a
program that queries a bunch of online game servers and displays info
about which players are currently connected to which servers:

http://tastyspleen.net/quake/servers/list.cgi

The source code for that program is here:

http://tastyspleen.net/quake/servers/list.rb

Again, we see all the HTML is dynamically generated within the program
itself. This inline approach is often OK for small programs like this, but
if one were writing larger web programs, it's preferable to separate the
HTML from the code. This is usually accomplished with a templating
system, which you'll be introduced to when you begin exploring the
various ruby web frameworks available.


Hope this helps,

Bill
 
F

F. Senault

Le 24 mars à 22:27, Gib Let a écrit :
But what type of things would you use Ruby for within a website? And
would you use HTML for example, to create the structure, or is it all
done in Ruby?

Well, you can do everything in Ruby that can be done with a programming
language, including writing a webserver from scratch...

Now, the common usage is :
- templating (ala PHP / ASP - what you suggest above, a mix and match of
Ruby code and HTML code),
- database connections (to use with the templates),
- user authentication modules,
- interfacing with mail servers,
- miscellaneous content generation (e.g. generating images or PDF on the
fly).

A web framework like Rails offers to do all of the above ; some are
lighter, and some applications can be designed to work with other
systems (like user authentication modules that could be called directly
from any kind of web application).

Fred
 

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,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top