Help me to understand a Ruby file

Hello everyone, I’m a new to the site and I’m just starting to learn
Ruby! The professor gave us the files to study but I need your help to
understand them! Can you help me? Attached the file Thanks

Looks like a fragment of a simple HTML builder to me.

What part(s) don’t you understand?

I don’t understand the last 2 methods.Can u help me?

Joel P. can u help me?

On Jul 9, 2013, at 2:24 AM, Salvo F. [email protected] wrote:

I don’t understand the last 2 methods.Can u help me?


Posted via http://www.ruby-forum.com/.

Install a ruby, run irb, load the file with these methods, and try them
out. These methods are at such an elementary level, you really need to
read and try things before jumping on the mailing list and asking
questions. What have you read already? What books, web sites, articles,
etc? Expecting very busy people to answer such basic questions when it
is apparent you have not done any homework of your own is really asking
too much.

If you understand the first two, the last two should give you no
trouble.

  1. The method takes in some Strings as arguments.
  2. The method creates a “result” String to be returned.
  3. The method inserts the arguments (name, value, errors) into the “HTML
    tag” Strings using “interpolation”
  4. The method appends other predefined “HTML tag” Strings to the
    “result” String
  5. The method returns the “result” implicitly.

Now:
Go and read some introductory guides.
Look up all the words which are new to you.
Install Ruby and play with IRB, as previously mentioned. Play is the
best way to learn.

This might help:

Learn to Program, by Chris Pine

A nice tutorial starting from the very basics.

Regards,
Marcus

Thank u!!!