import type { SymbolInfo, SyntaxNode } from '../types.js'; import type { LanguageDefinition } from './types.js'; import type { LanguageTraverser, DeclarationFunctionInfo } from '../traversers/types.js'; import type { LanguageExportExtractor, LanguageImportExtractor, LanguageSymbolExtractor } from '../extractors/types.js'; /** * Ruby AST traverser * * Ruby structure: * - Methods are defined with `def` (`method`) or `def self.x` (`singleton_method`) * - Classes and modules are containers whose methods we extract * - Container bodies are `body_statement` nodes */ export declare class RubyTraverser implements LanguageTraverser { targetNodeTypes: string[]; containerTypes: string[]; transparentContainerTypes: string[]; declarationTypes: string[]; functionTypes: string[]; shouldExtractChildren(node: SyntaxNode): boolean; isDeclarationWithFunction(_node: SyntaxNode): boolean; getContainerBody(node: SyntaxNode): SyntaxNode | null; shouldTraverseChildren(node: SyntaxNode): boolean; findParentContainerName(node: SyntaxNode): string | undefined; findFunctionInDeclaration(_node: SyntaxNode): DeclarationFunctionInfo; } /** * Ruby export extractor * * Ruby has no explicit export syntax. All top-level (module-level) definitions * are considered exported / loadable by other files: * - Classes: `class User; end` * - Modules: `module Billing; end` * - Methods: `def helper; end` and `def self.helper; end` * - Constants: `VERSION = '1.0'` */ export declare class RubyExportExtractor implements LanguageExportExtractor { private readonly exportableTypes; extractExports(rootNode: SyntaxNode): string[]; } /** * Ruby import extractor * * Handles require-like calls: * - require 'json' * - require_relative './foo' * - load 'config.rb' * - autoload :Bar, 'bar' */ export declare class RubyImportExtractor implements LanguageImportExtractor { readonly importNodeTypes: string[]; extractImportPath(node: SyntaxNode): string | null; extractImportPaths(node: SyntaxNode): string[]; processImportSymbols(node: SyntaxNode): { importPath: string; symbols: string[]; } | null; processImportSymbolsList(node: SyntaxNode): Array<{ importPath: string; symbols: string[]; }>; } /** * Ruby symbol extractor * * Handles: * - method (def foo) * - singleton_method (def self.foo) * - class (class Foo) — 'class' symbol type * - module (module Foo) — 'interface' symbol type (see extractModuleInfo's * doc comment for why) * * Call sites: call (foo(), obj.method()) */ export declare class RubySymbolExtractor implements LanguageSymbolExtractor { readonly symbolNodeTypes: string[]; extractSymbol(node: SyntaxNode, content: string, parentClass?: string): SymbolInfo | null; extractCallSite(node: SyntaxNode): { symbol: string; line: number; key: string; } | null; private extractMethodInfo; private extractClassInfo; /** * `module` maps to the 'interface' symbol type, not 'class' — a module can * never be instantiated (`Foo.new` is a `NoMethodError` for a module), so * `class` would misdescribe it. `interface` is an imperfect but honest * fit: it's the closest of `SymbolInfo['type']`'s four existing values to * how Ruby actually uses a module — as a mixin (`include`/`extend`) that * contributes behavior without state of its own, the same non-instantiable * "shared behavior" role `interface` already plays for Java/C#/Kotlin * interfaces and Swift protocols (and, closer still, Rust traits, which are * genuinely mixed into implementing types much like a Ruby module is). * It's a weaker fit for a module used purely as a namespace (e.g. a * library's root `module Sidekiq`), but that's still strictly more honest * than `class`, which would claim instantiability the module doesn't have. * * A dedicated `module` symbol type would be the more precise label, but * `SymbolInfo['type']`/the MCP `symbolType` filter enum is a small, closed * set threaded through `list_functions`'s filter, `signature-delta.ts`, * complexity/risk scoring, and every formatter — adding a fifth value for * one language's gap is exactly the ripple `csharp.ts` (see * `extractPropertyInfo`'s doc comment) deliberately avoided for its own * single-language gap. This makes the same call: reuse the closest * existing bucket rather than widen the shared enum. */ private extractModuleInfo; } export declare const rubyDefinition: LanguageDefinition; //# sourceMappingURL=ruby.d.ts.map