_M.ruby - Textadept API

# Textadept

- Home |
- Download |
- Lua API |
- Source |
- Language Modules |
- Stats |
- Wiki |
- Mailing List

# _M.ruby

The ruby module. It provides utilities for editing Ruby code.

## Key Bindings

- `Ctrl+L, M` (`⌘L, M` on Mac OSX | `M-L, M` in curses) Open this module for editing.
- `Shift+Enter` (`⇧↩` | `S-Enter`) Try to autocomplete an `if`, `while`, `for`, etc. control structure with `end`.
- `.` When to the right of a known symbol, show an autocompletion list of fields and functions.
- `::` When to the right of a known symbol, show an autocompletion list of fields and functions.

## Fields

### `sense`

The Ruby Adeptsense. It loads user tags from `_USERHOME`/modules/ruby/tags and user apidocs from `_USERHOME`/modules/ruby/api.

## Functions

### `toggle_block`()

Toggles between `{ ... }` and `do ... end` Ruby blocks. If the caret is inside a `{ ... }` single-line block, that block is converted to a multiple-line `do .. end` block. If the caret is on a line that contains single-line `do ... end` block, that block is converted to a single-line `{ ... }` block. If the caret is inside a multiple-line `do ... end` block, that block is converted to a single-line `{ ... }` block with all newlines replaced by a space. Indentation is important. The `do` and `end` keywords must be on lines with the same level of indentation to toggle correctly.

### `try_to_autocomplete_end`()

Tries to autocomplete Ruby’s `end` keyword for control structures like `if`, `while`, `for`, etc.

See also:

- `control_structure_patterns`

## Tables

### `_G.keys.ruby`

Container for Ruby-specific key bindings.

### `_G.snippets.ruby`

Container for Ruby-specific snippets.

### `control_structure_patterns`

Patterns for auto `end` completion for control structures.

See also:

- `try_to_autocomplete_end`