Ruby In Steel :: Help Index :: SapphireSteel Software Front Page Return to the Index
Five Minute Guide To Ruby In Steel
See Also

Glossary Item Box

This is a short hands-on tutorial to the basic project creation and editing features of Ruby In Steel.

Create a New Project

You can start a new Ruby In Steel project just as you would start any other Visual Studio project: select the File menu, then New, then Project.

 

Projects and Solutions: Ruby In Steel organizes projects in the form of branches in a solution. A project is a group of one or more files in one or more directories. A solution is a group of one or more projects. You can add new projects by right-clicking the solution at the top of the Solution Explorer and selecting Add, New Project. The Solution Explorer provides a convenient way of keeping related files grouped together from one work session to the next. For Rails programmers, it also gives you an easy way of working with the numerous folders comprising a Rails application.


The New Project Dialog

When the New Project dialog appears, select the Ruby In Steel branch in the left-hand pane. For now we shall create a plain vanilla Ruby project so make sure the Ruby Project icon is selected in the right hand window.

Create a new Ruby project

Give the project a name by filling out the Name: field at the bottom of the dialog (for now enter the name RubyTest). If you wish, you may click the Browse button to select a directory, otherwise you may accept the default location. If you check the 'Create directory for solution' button (recommended), a new subdirectory will automatically be created for your project. Click OK.

Before you can start programming you need to add a Ruby program file to the Project. In the Solution Explorer right-click the indented Project branch (not the top-level Solution itself) and select Add, then New Item

In the Add New Item dialog, select the Ruby File item (this will create an empty Ruby file).

Give this file the name, test.rb, in the field at the bottom of the dialog. Then click Add.

Editing

Now you are ready to start writing your program. Enter the following: 

def sayHello( aName ) 
   
print( "Hello, ", aName ) 
end

puts( "What is your name?" )
name = gets()
sayHello( name )

Notice that Ruby In Steel automatically color codes the text as you enter it so that reserved words such as def and end are obviously different from method names and strings such as “Hello”. It also 'outlines' your code so that the body of a method such as def sayHello can be hidden from sight by clicking the minus symbol in the 'button' to the left of its name or made visible again by clicking the plus symbol. Ruby In Steel has advanced 'code collapsing' capabilities. It collapses methods, modules, classes, if..else blocks, case statements, for, while and until loops, blocks delimited by { and } or by do and end - and more besides...

The Interactive Console


Here the interactive console is docked beneath the code editor. 

To run the program , press CTRL+F5. If there is a syntax error a window pops up to tell you. Click the error message to locate the problem code in the editor. Fix the error and try again. When any syntax errors are fixed, press F5 again and your program will run inside an interactive integrated console window.

See Also