Ruby In Steel :: Help Index :: SapphireSteel Software Front Page Return to the Index
Expansion and SurroundsWith Snippets
See Also

Glossary Item Box

Most snippets are 'Expansion' snippets which means that their text is simply inserted into the code editor; if any other text happens to be selected at the time, it will be replaced by the expanded snippet. Some snippets are also defined to be 'SurroundsWith' snippets. If you select text in the code editor and then insert a SurroundsWith snippet, the snippet text will enclose the selected text.


The if snippet is a SurroundsWith snippet. Let's assume that you have already entered the following into the code editor:

puts( 'hello world' );

You select this text, then right-click and choose if from the Snippet menu. When the if snippet is entered it automatically surrounds the selected text, resulting in this:

if true then
    puts( 'hello world' );

In this case, true is a replacement point and it is selected so that you can immediately replace it with your desired test condition.

See Also