Documentation
¶
Overview ¶
Package ruby provides a documentation source adapter that reads Ruby source code from a local checkout of a Ruby framework repository (Rails, RSpec, Sidekiq, etc.). It parses raw Ruby source via tree-sitter to extract classes, modules, methods, and YARD documentation without making any network calls during parsing.
Index ¶
- func NewCampingFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewCubaFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewDeviseFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewDryRbFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewDrySystemFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewFaradayFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewGrapeFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewHanamiFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewMinitestFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewNokogiriFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewPadrinoFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewPumaFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewRSpecFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewRackFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewRailsFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewRamazeFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewRodaFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewSequelFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewSidekiqFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewSinatraFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewStdlibFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- type Config
- type Option
- type RubySource
- func (s *RubySource) DetectWrapper(method *source.Method) (bool, string, string)
- func (s *RubySource) DiscoverEntities(ctx context.Context, fetch source.FetchFunc) ([]string, error)
- func (s *RubySource) ID() string
- func (s *RubySource) Meta() source.LibraryMeta
- func (s *RubySource) ParseEntity(ctx context.Context, entityID string, content []byte) (*source.Entity, []string, error)
- func (s *RubySource) ParseMethod(ctx context.Context, methodID string, content []byte) (*source.Method, error)
- func (s *RubySource) ParseSourceCode(entityID string, content []byte) (string, error)
- func (s *RubySource) ResolveWrapperURL(targetName, targetKind, entitySlug string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCampingFactory ¶
NewCampingFactory creates a Source for the Camping micro web framework.
func NewCubaFactory ¶
NewCubaFactory creates a Source for the Cuba micro framework.
func NewDeviseFactory ¶
NewDeviseFactory creates a Source for Devise authentication.
func NewDryRbFactory ¶
NewDryRbFactory creates a Source for Dry-rb.
func NewDrySystemFactory ¶
NewDrySystemFactory creates a Source for the dry-system application framework.
func NewFaradayFactory ¶
NewFaradayFactory creates a Source for Faraday.
func NewGrapeFactory ¶
NewGrapeFactory creates a Source for the Grape REST API framework.
func NewHanamiFactory ¶
NewHanamiFactory creates a Source for the Hanami web framework.
func NewMinitestFactory ¶
NewMinitestFactory creates a Source for Minitest.
func NewNokogiriFactory ¶
NewNokogiriFactory creates a Source for Nokogiri.
func NewPadrinoFactory ¶
NewPadrinoFactory creates a Source for the Padrino full-stack framework.
func NewPumaFactory ¶
NewPumaFactory creates a Source for Puma.
func NewRSpecFactory ¶
NewRSpecFactory creates a Source for the RSpec testing framework.
func NewRackFactory ¶
NewRackFactory creates a Source for Rack.
func NewRailsFactory ¶
NewRailsFactory creates a Source for Ruby on Rails.
func NewRamazeFactory ¶
NewRamazeFactory creates a Source for the Ramaze modular web framework.
func NewRodaFactory ¶
NewRodaFactory creates a Source for the Roda routing tree web framework.
func NewSequelFactory ¶
NewSequelFactory creates a Source for the Sequel database toolkit. Replaces Lucky, which is written in Crystal and cannot be indexed by the Ruby adapter.
func NewSidekiqFactory ¶
NewSidekiqFactory creates a Source for Sidekiq.
func NewSinatraFactory ¶
NewSinatraFactory creates a Source for Sinatra.
func NewStdlibFactory ¶
NewStdlibFactory creates a Source for the Ruby standard library.
Types ¶
type Config ¶
type Config struct {
// LibraryID is the canonical identifier (e.g., "/ruby/rails").
LibraryID string
// Name is the display name for the library (e.g., "Rails Reference").
Name string
// Description is the library description.
Description string
// SourceURL is the GitHub URL for the framework (e.g., "https://github.com/rails/rails").
SourceURL string
// Version is the version string for the library.
Version string
// TrustScore is the relevance trust score (0-1).
TrustScore float64
// SourceRoots are the directory paths relative to the repo root that
// contain the framework's source code (e.g., ["lib"] for gems,
// ["activerecord/lib"] for Rails components).
SourceRoots []string
}
Config holds the framework-specific configuration for a RubySource.
type RubySource ¶
type RubySource struct {
// contains filtered or unexported fields
}
RubySource is a documentation source adapter that reads Ruby source code from a local repository checkout. It is configurable for any Ruby framework (Rails, RSpec, Sidekiq, etc.).
func New ¶
func New(repoPath string, cfg Config, opts ...Option) *RubySource
New constructs a new RubySource for the given local repository path and framework configuration.
func (*RubySource) DetectWrapper ¶
DetectWrapper analyzes a method's source code for wrapper patterns.
func (*RubySource) DiscoverEntities ¶
func (s *RubySource) DiscoverEntities(ctx context.Context, fetch source.FetchFunc) ([]string, error)
DiscoverEntities walks the local repository and returns a sorted list of entity identifiers in the form "filepath#Module::ClassName".
func (*RubySource) Meta ¶
func (s *RubySource) Meta() source.LibraryMeta
Meta returns metadata for the library record.
func (*RubySource) ParseEntity ¶
func (s *RubySource) ParseEntity(ctx context.Context, entityID string, content []byte) (*source.Entity, []string, error)
ParseEntity parses a single entity from file content, identified by entityID. The entityID is of the form "filepath#Module::ClassName".
func (*RubySource) ParseMethod ¶
func (s *RubySource) ParseMethod(ctx context.Context, methodID string, content []byte) (*source.Method, error)
ParseMethod parses a single method from file content. The methodID is of the form "filepath#Module::ClassName#methodName" or "filepath#Module::ClassName.self.methodName" for singleton methods.
func (*RubySource) ParseSourceCode ¶
func (s *RubySource) ParseSourceCode(entityID string, content []byte) (string, error)
ParseSourceCode extracts just the source code of a specific entity or method from file content, using the fragment in the identifier.
func (*RubySource) ResolveWrapperURL ¶
func (s *RubySource) ResolveWrapperURL(targetName, targetKind, entitySlug string) string
ResolveWrapperURL constructs the identifier to fetch the wrapped target's source.