< Software Engineers Handbook < Language Dictionary

Ruby

The wikipedia entry is here.

Type

Ruby is a full objected-oriented language.

Execution Entry Point

<Describe how/where the program is started i.e. C++ main()>

General Syntax

<Try to give a high level description of the contents of a typical line of code. An assignment example may be appropriate such as

a = b;

>

Comments

Pound signs (#) designate comments in Ruby

# this is an inline comment.  Everything after the # is a comment.

Variable Declarations

Ruby does not require explicit variable declarations. The following is perfectly valid Ruby code

x = 5

(x:5)

z = x+3

(z:8)

string = 'a string'

(string:'a string')

longstring = string+string

(longstring:'a stringa string')

Yet there are times when a declaration of type is necessary. In the following operation the array named 'objects' must be defined as an array so it can use the << method of adding elements to the array

objects = []
objects << "my 1st array elements"
objects << "my 2nd array element"
objects << 52=+3

(objects: ["my 1st array element", "my 2nd array element", 55])

Method Declaration/Implementation

<Describe how methods/functions/procedures are declared and implemented.>

Scope

<Describe how scope is defined.>

Conditional Statements

<Describe the conditional statements in text and present

code examples. 

(put a space in the front of the line to format as code)>

Looping Statements

<Describe looping statements in English and present code examples.>

Output Statements

<Describe how to output Hello world! including the new-line with or without a carriage return.>

Error Handling/Recovery

<Describe error handling and recovery. Give examples as appropriate.>

Containers

<List containers or references to lists of containers available natively for this language. List ways to incorporate containers if they are not native to the language.>

Algorithms

<List algorithms or references to lists of algorithms available natively for this language. List ways to incorporate algorithms if they are not native to the language. Or, if not available, describe that.>

Garbage collection

<Describe whether the garbage collection is automatic or manual.>

Physical Structure

<Describe how the files, libararies, and parts are typically divided and arranged.>

Tips

<Please include tips that make it easier to switch to this language from another language.>

Web References

<List additional references on the web. Please include for what level reader the references are appropriate. (beginner/intermediate/advanced)>

Books and Articles

<List additional books and articles that may be helpful. Please include for what level reader the references are appropriate. (beginner/intermediate/advanced)>

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.