Build an HTML Heading Generator in Ruby

0
1311

In this Ruby coding exercise you’ll learn how to build an HTML H1 heading generator that takes in a title and outputs a full HTML title.

Summary

Build a program that dynamically generates an HTML H1 heading tag.

Exercise File

Code File

Exercise Description

Given the following string:

"My Title"

Write a program that generates an HTML H1 heading.

Sample Input

"My Title"

Sample Output

"<h1>My Title</h1>"

Real World Usage

String interpolation is common in everyday Ruby and/or Rails development. This particular exercise has a number of solutions, including a standard string based approach, along with an array based strategy.

Solution

Can be found on the solutions branch on github.

LEAVE A REPLY

Please enter your comment!
Please enter your name here