I am interested in learning ruby for web development. I was looking into
ruby on rails, but on my PHP code i wrote a very simple template engine
I was wondering how difficult it would be to convert it to ruby and use
it as my template engine instead of Ruby on Rails. Any assistance would
be greatly appreciated.
Ruby itself is a full fledged programming language, and as such it can
be used to do anything–including web programming. Ruby on Rails(R0R) is
a web framework that is written in ruby. Web frameworks are typically
massive productions that enable you to produce (supposedly) bullet
proof web sites by employing the wisdom of experts–if you have the
time/ability to figure out how they work.
There are also more minimal web frameworks written in ruby of which
Sinatra is probably the most famous. They are a reaction to the
complexity of Ruby on Rails. See here:
In addition, ruby already has a template engine in its Standard Library
called ‘erb’ (embedded ruby).
my_template = “Hello <%= greeting %>!”
greeting = “world”
renderer = ERB.new(my_template)
result = renderer.result()
And then there are thousands of other template engines written in ruby
by people like yourself:
To summarize, you can use ruby to do your web programming, or you can
step up to a lightweight framework like Sinatra, or you can employ a
heavy weight web framework like ROR. Independent of how you decide to
do your web programming, you can choose from many template engines, or
convert your own to ruby.