Ruby Cursor Rules

Learn about cursor rules specific to Ruby development.

Ruby-Specific Rules

Cursor rules in Ruby provide intelligent navigation and manipulation capabilities designed specifically for Ruby development. These rules help you work more efficiently with Ruby's dynamic features, blocks, and object-oriented patterns.

Code Navigation

  • Navigate between class and module definitions
  • Jump to method definitions and blocks
  • Move between do/end and block pairs

Smart Selection

  • Select method blocks and module inclusions
  • Expand selection to include block parameters
  • Smart symbol and string interpolation selection

Code Manipulation

  • Quick method and module insertion
  • Automated block parameter handling
  • Module and require statement management

Best Practices

  • Use block-aware navigation
  • Leverage method-specific cursor movements
  • Utilize module-aware selection

Examples

# Navigate between class and module definitions
module Printable
  def print
    puts to_s
  end
end

class Document
  include Printable
  
  def initialize(content)
    @content = content
  end
  
  def to_s
    @content
  end
end

# Smart selection of blocks and interpolation
class DataProcessor
  def process_items
    items.map do |item|
      "Processing #{item}"
    end
  end
  
  def with_logging
    yield if block_given?
  rescue => e
    puts "Error: #{e.message}"
  end
end

Configuration

Customize Ruby-specific cursor rules in your settings:

{
  "ruby.cursorRules": {
    "blockNavigation": true,
    "smartSelection": true,
    "moduleHandling": true
  }
}