Forum: Ruby PHP to Ruby Conversion

99cb7d038f205ea0e4b9676abac856ab?d=identicon&s=25 Aleeious MMO (aleeious)
on 2014-06-24 05:43
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
available here:
https://github.com/Aleeious/AleeiousMMO/blob/maste....
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.

Sincerely,

Aleeious
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2014-06-24 20:06
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:

http://codecondo.com/12-small-ruby-frameworks/

In addition, ruby already has a template engine in its Standard Library
called 'erb' (embedded ruby).

require 'erb'

my_template = "Hello <%= greeting %>!"
greeting = "world"

renderer = ERB.new(my_template)
result = renderer.result()
puts result

--output:--
Hello world!

And then there are thousands of other template engines written in ruby
by people like yourself:

https://www.ruby-toolbox.com/categories/template_engines

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.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.