Aptana Studio ヘルプ > はじめに > RDT (Ruby Development Tools) > Ruby Editor

Ruby code folding

This help topic gives an overview of the Ruby code folding feature.

Contents

Introduction

Code folding is a feature that allows you to expand or collapse blocks of ruby code. It's a nice way to temporarily "hide" blocks of code that just aren’t relevant right now, or that you don’t want to focus on. It's a way to reduce the visual noise.

Image:rubyFolding.gif

Instructions

You can fold classes, modules and methods. Ruby will let you know when it has found a block that it can collapse and expand by placing a +/- bubble over on the left hand "ruler" of the editor.

To "fold" or "collapse" the block, click on the - bubble in the ruler. The contents of the block will be hidden, and only the first line will remain. If you hover the cursor over the + bubble a tooltip will show you the source code that is hiding underneath. You can also tell that it is collapsed because a box with two periods in it will appear at the end of the line.

Image:folding_hover.gif

To expand the code, click on the + bubble in the ruler. The code will expand out again.

Advanced Folding

If you right-click on the left-hand ruler of the editor you'll see the menu include a Folding section. From here you can manipulate folding at a higher level. You can expand or collapse all blocks, just members*, reset the initial structure, or even toggle folding on and off. The menu will also show you the keyboard shortcut for these commands.

* members are blocks of code with a parent. So if a method is defined within a class, it’s a member; if it’s outside a class in the top-level, it’s not.

Image:folding_menu.gif

Related Topics