[Nitro] Can nitro be used with eruby?

Anne G anne at wjh.harvard.edu
Wed Jun 14 11:14:44 EDT 2006

1. using Nitro

> while there are some complex parts in Nitro, one can
> safely ignore most of it and do simple, template-driven
> Web sites quite easily.

Sounds like what I need. Right now I am trying to learn the

> Q10: Ok! I see the example, I run it, but I do not
> understand what is happening. Could you explain the
> execution cycle of a small application like the
> HelloWorld? E.g when I do: "ruby run.rb" what happens?

George answered I 'll come back with this one :)
but he did not!!! I wish  he had.

the tutorial uses a skeleton, not what I am looking for
right now. The examples George and James gave me were best.
I started with George's example, instead of
      The time now is #{Time.now}
I tried,

in public, index.xhtml:
       <?r puts "this is cool" ?>
       or what
, I only get, or what.

Next I tried puting the ruby code in the run.rb

require 'nitro'

and trying
     The value is #{value1}
that gave an error
     The value is #{value1=1}
worked (I get: the value is 1).

I thought James example would be easy to use
but I get an error, right now I don't see what could be
the problem. its from day 2 teach yourself ruby!

#--- File src/controller/main/rb ---

class Main
   def index
     @title = "Erb Example"
     @body = task1 +task2


   def task1
     return "1"

   def task2
     return "2"

   def emit
     template = ERB.new( html )

   def html
     "<html><head><title><%=@title %></title></head>
     <body><%= @body %></body></html>"

That's for the applied exercise using NITRO.

For the conceptural issues involved, I wrote down what I
understood so far. It is still a bit vague, but I will clean
my post as I find more info.

was a big step forward.

My thinking is that with apache, I can set up a .htaccess
file, which will redirect calls to a cgi file which would
act as james controller. I should do it just to demonstrate
the concept.

But first it would be nice to have George et James modified
examples working

thanks for your help,


More information about the Nitro-general mailing list