Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

SyntaxSuggest::BlockExpand#expand_indent

expand_indent(block)

Expands code to the next lowest indentation

For example:

1 def dog
2   print "dog"
3 end

If a block starts on line 2 then it has captured all it’s “neighbors” (code at the same indentation or higher). To continue expanding, this block must capture lines one and three which are at a different indentation level.

This method allows fully expanded blocks to decrease their indentation level (so they can expand to capture more code up and down). It does this conservatively as there’s no undo (currently).

See also #call #expand_neighbors .new #inspect also in 4.0 · 3.4 · 3.2