rubyextractor

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package rubyextractor provides a tree-sitter based extractor for Ruby files. It implements types.Extractor and produces declaration nodes and syntactic call/import edges without type resolution.

Supported file extensions: .rb Excluded: files under vendor/ directories

Node types extracted:

  • class -> "type" nodes with nested "method" nodes
  • module -> "type" nodes
  • method (def) -> "function" (top-level) or "method" (inside class/module)
  • singleton_method (def self.foo) -> "method" nodes
  • require/require_relative -> "imports" edges
  • call/method_call -> "calls" edges
  • class Foo < Bar -> "extends" edge
  • include/extend ModuleName -> "implements" edges
  • Rails-style class-level method calls -> "decorates" edges
  • Rails route patterns in config/routes.rb -> "handles_route" edges

All edges use provenance "ast_inferred" and confidence 0.7, since without type resolution cross-module calls are heuristic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RubyExtractor

type RubyExtractor struct{}

RubyExtractor implements types.Extractor for Ruby files using tree-sitter AST parsing. Thread-safe: each Extract call creates its own parser (required for concurrent use; tree-sitter parsers are not goroutine-safe).

func NewRubyExtractor

func NewRubyExtractor() *RubyExtractor

NewRubyExtractor creates a new RubyExtractor.

func (*RubyExtractor) CanHandle

func (e *RubyExtractor) CanHandle(path string) bool

CanHandle returns true for .rb files that are not in vendor/ directories.

func (*RubyExtractor) Extract

Extract parses the Ruby file with tree-sitter and produces nodes for declarations and edges for calls and imports.

func (*RubyExtractor) Name

func (e *RubyExtractor) Name() string

Name returns the extractor name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL