Docs / languages / ruby · Edit on GitHub

Ruby

Tier 1 plugin for Ruby source (Rails-style apps, gems, scripts). Extracts classes, modules, methods, require graph, mixin edges, calls, and constructor metadata.

Implementation

Plugin cratecrates/rgctl-lang-ruby (RubyPlugin)
Grammartree-sitter-ruby (pinned in crate Cargo.toml)
Extensions.rb, .rake, .gemspec (via languages.toml)
Discoverrgctl discover . -l ruby -e vendor,tmp,node_modules --with-cfg
CFG / taintEnabled (LanguageAnalysisProfile)

AST coverage is tracked in crates/rgctl-lang-ruby/ruby-ast-coverage.json (CI: ruby_ast_coverage_manifest_matches_grammar).

What is extracted

Nodes

  • Function — instance and singleton methods; FQN uses :: for constants/modules and # / . for methods (see ruby-extract-honesty.md)
  • Class / Module
  • Importrequire / require_relative targets (unresolved string paths as import symbols)
  • Fieldattr_* and ivars assigned in initialize (Layer F symbols)

Edges

EdgeMeaning
CALLSStatically resolved calls; dynamic calls tagged metadata.unresolved
EXTENDSinclude / prepend into class/module
USESextend on singleton
INSTANTIATES.new on constant/receiver
ImportRequire graph

Honesty limits

See ruby-extract-honesty.md — no Ruby method lookup, refinements, or full block/yield CFG for arbitrary procs.

Verification

Fixturergctl-tests/ecommerce-ruby
Langfeaturestests/fixtures/ruby/langfeatures
Example corpusexample/discourse (-l ruby; RGCTL_DISCOURSE_REPO)
Smoke scriptrgctl-tests/gql-verification-smoke/verify-extraction-gql-ruby.sh
RGCTL=target/release/rgctl ./rgctl-tests/gql-verification-smoke/verify-extraction-gql-ruby.sh

Integration tests: tests/ruby_langfeatures.rs, tests/ruby_cfg_analysis.rs, tests/dashboard_ecommerce_ruby.rs, tests/ruby_taint.rs (taint unit tests in rgctl-analysis).

Related