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.
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 type | Constructed |
|---|---|
calls | constructed by this analyzer |
extends | constructed by this analyzer |
implements | ruled absent |
uses | constructed by this analyzer |
imports | constructed by this analyzer |
exports | constructed by this analyzer |
contains | constructed by this analyzer |
references | constructed by this analyzer |
overrides | constructed by this analyzer |
instantiates | constructed by this analyzer |
decorates | ruled absent |
renders | ruled absent |
mixes_in | constructed by this analyzer |
part_of | ruled 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 :linesemits an edge at confidence 0.8, below the 0.85 evidence cutoff, so it is classedinferred; and only asimple_symbolor astringargument is accepted, because accepting a bare identifier was measured publishingcontains -> rolefor 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 < ApplicationRecordpairssave!with the parent'ssave!at 0.95;class Body < Struct.new(:a)gets noextendsedge at all; and a base this file does not declare produces a 0.5 edge carryingreasonCode: "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 fooandalias a bare 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
.rbfiles too, so a checked-invendor/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.
- Which classes include this module, and what do they pick up from it?
- Which methods call this one, and which method does it override?
- Which associations has this ActiveRecord model declared?
- Where is this method defined — in the class, in a concern, or at file scope?
What the analyzer sees in code like this
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
endSymbols 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.