Here is the Ruby code to print "Hello Ruby"
The output will be:
Ruby provides a program called ERB (Embedded Ruby), which allows you to put Ruby codes inside an HTML file. ERB reads along, word for word until it encounters a Ruby code embedded in the document and starts executing the Ruby code thereon.
You need to know a few things to prepare an ERB document −
If you want some Ruby code executed, enclose it between <% and %>.
If you want the result of the code execution to be printed out, as a part of the output, enclose the code between <%= and %>.
Let us go through an example. Save the code in erbdemo.rb file.
Note: A Ruby file will have an extension .rb
Now, run the program using the command-line utility erb.
This will produce the output as −
Rail framework uses Metaprogramming techniques to write programs as against other frameworks which use extensive code generation from scratch. Ruby is one of the best languages for Metaprogramming, and Rails uses this capability well. Rails also uses code generation but relies much more on Metaprogramming for the heavy lifting.
Convention over configuration
Ruby on Rails Related Interview Questions
|Python Interview Questions||HTML 5 Interview Questions|
|PHP Interview Questions||PostgreSQL Interview Questions|
|Ruby Interview Questions||Django Interview Questions|
|wxPython Interview Questions||MongoDB Interview Questions|
|Python Automation Testing Interview Questions||GitHub Interview Questions|
|Ruby Sinatra Interview Questions|
Ruby On Rails Tutorial
Ruby On Rails
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.