Question: Ruby programming Assignment. Please write all the information so I can understand it. Thank you. Create a Ruby definition which adds some small methods to
Ruby programming Assignment. Please write all the information so I can understand it. Thank you.

Create a Ruby definition which adds some small methods to the standard String and Array classes which might be of some use in writing a program to generate HTML output. The methods are: Stringhesc Add the hesc method to the string class. It takes no arguments, and returns a copy of the string with each of the characters and & replaced with their appropriate HTML entities. For instance, | "I like less-than (. Between is the original string after processing through hesc. For instance, "f00". tag("i"); returns the string foo. The purpose of the "first word of the argument" rule is to produce a correct closing tag when the tag includ spaces. For instance, "The Many Uses of &".tag("hi color-\"blue"") will return The Many Uses of bamp; Array#tag This simply returns a copy of the array with tag applied to each member. Array#nest This takes a single argument which is a tag under the same rules as Stringttag. It retums a copy of the string, with opening and closing tags added to the front and back. (The added tags are strings.) Place your Ruby code in a file which can be brought in with load. For instance: irb (main) :001:0> load "htmlgen.rb" => true irb(main):002:0> "a "a "a "a kt; b == (a " irb (main):004:0> ["a", "b", "c", "d"). tag("i") -> [" ", " ', ' ", " "} irbimain):005:0> ["a", "b", 'c',"0"].tag("i").nest("tr id=\"foo\"") => ["", "a", "", " ", "", "
"] irb(main): 006:0> ("1".."10").to_a.tag('td").nest("tr").join => "| 1 | 2 | 3 | 45 | 6 | 7 | 8 | 9 | 10 |
" irb(main): 007:0> ["al","bill", "sally", "jac" ).tag('div color="blue"').rest("div") -> ["', "
al
", '
bill
", '
sally
", "
joe
", "
"] irb (main): 008:0> ["a", "b", 'c'].nest("a href=\ 'nowhere\"") => ["", "a", "b", "c", " ] class="form e ,"a"); tag >" id=\"100\" ", ""} Create a Ruby definition which adds some small methods to the standard String and Array classes which might be of some use in writing a program to generate HTML output. The methods are: Stringhesc Add the hesc method to the string class. It takes no arguments, and returns a copy of the string with each of the characters and & replaced with their appropriate HTML entities. For instance, | "I like less-than (. Between is the original string after processing through hesc. For instance, "f00". tag("i"); returns the string foo. The purpose of the "first word of the argument" rule is to produce a correct closing tag when the tag includ spaces. For instance, "The Many Uses of &".tag("hi color-\"blue"") will return The Many Uses of bamp; Array#tag This simply returns a copy of the array with tag applied to each member. Array#nest This takes a single argument which is a tag under the same rules as Stringttag. It retums a copy of the string, with opening and closing tags added to the front and back. (The added tags are strings.) Place your Ruby code in a file which can be brought in with load. For instance: irb (main) :001:0> load "htmlgen.rb" => true irb(main):002:0> "a "a "a "a kt; b == (a " irb (main):004:0> ["a", "b", "c", "d"). tag("i") -> [" ", " ', ' ", " "} irbimain):005:0> ["a", "b", 'c',"0"].tag("i").nest("tr id=\"foo\"") => ["", "a", "", " ", "", "
"] irb(main): 006:0> ("1".."10").to_a.tag('td").nest("tr").join => "| 1 | 2 | 3 | 45 | 6 | 7 | 8 | 9 | 10 |
" irb(main): 007:0> ["al","bill", "sally", "jac" ).tag('div color="blue"').rest("div") -> ["', "
al
", '
bill
", '
sally
", "
joe
", "
"] irb (main): 008:0> ["a", "b", 'c'].nest("a href=\ 'nowhere\"") => ["", "a", "b", "c", " ] class="form e ,"a"); tag >" id=\"100\" ", ""}