CGI with Ruby

Discussion about the creation of websites in general, HTML, PHP, Java.

CGI with Ruby

Postby hafner on Fri Jan 05, 2007 8:52 am

Hi,

here's the first CGI program that I've written in Ruby:
Code: Select all
#!/usr/bin/env ruby
# -*-mode: ruby; coding: utf-8;-*-

require 'cgi'

class MyCGI < CGI
  def initialize
    super("html4")
  end
  def greet
    out do
      html{
        [head{
           [title{"A title"}]},
         body{
           [i{"Hello"},
            " ",
            b{"world!"}]
         }]}
    end
  end
end

cgi = MyCGI.new
cgi.greet
Regards
Thomas
hafner
Contributer
Contributer
 
Posts: 73
Joined: Tue Mar 07, 2006 2:18 pm
Location: München (Germany)

Re: CGI with Ruby

Postby bart416 on Wed May 30, 2007 8:46 pm

May I ask why one would like to use classes for a simple thing as hello world?
bart416
Valued Member
Valued Member
 
Posts: 164
Joined: Fri Sep 30, 2005 6:50 pm


Return to General Webmastering

Who is online

Users browsing this forum: No registered users and 1 guest

cron