Is there a specific way to put Ruby code in HTML or I can do it like we do with PHP?
You could use Ruby on Rails, a framework written in Ruby. If you are new to Ruby you could check out this article to get started with Rails and learn how to install it and create your first app.
Also, you can learn more about Ruby on Rails on its Wikipedia page here.
In order to use it, just like you would in PHP change the
file.html file, but in this case to
The syntax is as follows:
<h1><%= "I'm learning Ruby on Rails" %></h1>
Then you have to run it:
ruby -rerb -e 'puts ERB.new(File.read("file.erb")).result'