Skip to content

Language record

Ruby

Ruby is indexed as the object model it is: classes, modules and methods each get an identity, `include` and `extend` become composition edges, `require` becomes a reference, and the Rails macros in a model body become properties — so a Rails app's controllers, models and concerns read as one graph rather than a pile of files.

.rb · 1 registry id · 10 of 14 relationship types

The registry row this page is generated from

Read at render time from the same family row the register reads, so nothing in this block can disagree with it.

Extensions
.rb
Registry names
ruby
Recorded symbols
classes · modules · methods

Relationship types this analyzer constructs

10 of 14 constructed, read from this analyzer's source and re-derived by the languages gate. Each row below is one of the engine's types, in the engine's own order.

Relationship typeConstructed
callsconstructed by this analyzer
extendsconstructed by this analyzer
implementsruled absent
usesconstructed by this analyzer
importsconstructed by this analyzer
exportsconstructed by this analyzer
containsconstructed by this analyzer
referencesconstructed by this analyzer
overridesconstructed by this analyzer
instantiatesconstructed by this analyzer
decoratesruled absent
rendersruled absent
mixes_inconstructed by this analyzer
part_ofruled absent

10 constructed, 4 not constructed. All 4 absent types are recorded as ruled absent: the written reason and the corpus measurement behind each are in this family's completeness record. The register explains what each label means.

What this analyzer does not resolve

  • A Rails association macro publishes a property, not a call, and its argument rule is deliberately stricter than a plain call's. has_many :lines emits an edge at confidence 0.8, below the 0.85 evidence cutoff, so it is classed inferred; and only a simple_symbol or a string argument is accepted, because accepting a bare identifier was measured publishing contains -> role for a class's own parameter name.
  • An override is a name match against the declared superclass, so a dynamic superclass has nothing to match. class Invoice < ApplicationRecord pairs save! with the parent's save! at 0.95; class Body < Struct.new(:a) gets no extends edge at all; and a base this file does not declare produces a 0.5 edge carrying reasonCode: "first-parent-guess", so the edge is present and its weakness is readable.
  • A path assembled at run time is not a reference: require "#{dir}/x" is skipped — 217 such sites in the sampled corpora, 208 of them in rails — because the target exists only after interpolation. defined?(bar), undef foo and alias a b are skipped for the same reason of kind: none of them names a callee that can be called.

Every line above was written against Ruby’s own analyzer module and is named against a construct in it, so it can be checked against the source. Nothing here is inherited from a template, or from another language’s page.

Where you meet it in a repository

Recognised by extension — .rb. Everything below is about where those files actually sit in a working repository.

  • Rails writes the interesting declarations into the class body — has_many, belongs_to, scope, validates, before_save — and those become properties on the class rather than call edges, so the model layer is navigable without running it. Thirty-seven macro spellings are held in that list for exactly this reason.
  • Concerns are modules that get included, which is an edge: a method defined in a concern stays owned by the concern, and the composition edge is what answers who actually picks it up.
  • Vendored gem sources are .rb files too, so a checked-in vendor/ tree indexes as a second Ruby codebase sitting beside your own.

Questions this index answers

Phrased as retrievals, because that is what an index can honestly do: it holds the symbols and the edges between them, and hands them back with the evidence attached.

  1. Which classes include this module, and what do they pick up from it?
  2. Which methods call this one, and which method does it override?
  3. Which associations has this ActiveRecord model declared?
  4. Where is this method defined — in the class, in a concern, or at file scope?

What the analyzer sees in code like this

A module, a class with a declared superclass, and the macro in its body
module Billing                      # bb records: module Billing
  VERSION = "1.4"                      # bb records: constant VERSION on Billing
end

class Invoice < ApplicationRecord     # bb records: class Invoice, extends ApplicationRecord
  has_many :lines                     # bb records: a property plus an inferred use edge
  def save!                           # bb records: method save! on Invoice
    Ledger.post(self.total)           # bb records: calls -> post, target Ledger.post
  end
end

Symbols are stored with the file they came from and the bytes they span, so a hit points at a line rather than at a guess. The annotations in the sample are commentary for the reader, not strings the index would store.

Languages that turn up in the same repository

Scripting & shell — the count beside each name is how many relationship types that family’s analyzer constructs.

The extensions, registry names, recorded symbols and relationship types above are the parser registry row for Ruby, read while the page rendered — the same row the register reads, so the two surfaces cannot tell two stories. Every relationship type listed as constructed appears in src/ast/real-*, the analyzer modules bb ships. bb 0.1.0 answers from a local store over 50 languages (53 registry ids, three of them aliases). There is no benchmark on this page: every claim here is one you can go and read in the source.