model

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(s *Summary) string

Format renders the summary as a human-readable string.

func IsAmbiguousError

func IsAmbiguousError(err error) bool

IsAmbiguousError reports whether err indicates multiple model matches.

func Resolve

func Resolve(railsRoot, modelsPath, input string) (string, error)

Resolve finds the model file for the given name or path within railsRoot.

Types

type Summary

type Summary struct {
	ClassName   string
	ParentClass string
	RelPath     string
	TableName   string
	Concerns    []string
	Assocs      []string
	Valids      []string
	Scopes      []string
	Callbacks   []string
	Enums       []string
	Delegates   []string
}

Summary holds the extracted model structure.

func Parse

func Parse(modelPath, railsRoot, modelsPath string) (*Summary, error)

Parse reads a model file and returns its structural summary. NOTE: This function relies heavily on regular expressions to parse Ruby code. This approach is inherently fragile and may not correctly parse all Ruby code styles or complex constructs. It is a known trade-off for simplicity and avoiding a full Ruby parser dependency.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL