Ruby?

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?

On Mon, Mar 24, 2008 at 3:13 PM, Gib L. [email protected]
wrote:


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

http://code.whytheluckystiff.net/camping/
http://merbivore.com/


“Hey brother Christian with your high and mighty errand, Your actions
speak
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)

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?

On Mar 24, 2008, at 3:13 PM, Gib L. wrote:

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.

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

On Mar 24, 2008, at 10:13 PM, Gib L. wrote:

Can anyone shead a little light on it for me?

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

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

On Mon, Mar 24, 2008 at 5:27 PM, Gib L. [email protected]
wrote:

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| %>

  • <%= car.vin %>

  • <% end %>

    Glen H. wrote:

    Can anyone shead a little light on it for me?

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

    www.rubyonrails.org
    www.nitroproject.org
    http://code.whytheluckystiff.net/camping/
    http://merbivore.com/

    Check out this page

    http://ramaze.net/home

    near the bottom.

    There’s a good list of the 15+ Ruby Web frameworks available.

    I’m partial to Ramaze.

    To learn more about Ruby the language, see

    www.ruby-lang.org


    James B.

    http://www.rubyaz.org - Hacking in the Desert
    http://www.jamesbritt.com - Playing with Better Toys

    Le 24 mars à 22:27, Gib L. 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

    From: “Gib L.” [email protected]

    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:

    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