How obsidiannnn/low_type works
LowType is a Ruby runtime type-expression gem: it interprets type annotations in method definitions and checks arguments and return values, with additional support for typed instance accessors, runtime local variables, enumerable and union syntax, and a Sinatra adapter. The main flow begins when a class includes LowType: it locates and parses the class’s source, evaluates annotations, then prepends wrappers that validate calls. The README documents capabilities whose implementation was not excerpted; those are represented where the tree supports a path, with uncertain links omitted.
Main entry points: low_type.rb LowType entry · evaluator.rb Annotation evaluator · redefiner.rb Method wrappers · type_expression.rb Type expressions
Components 21
Integration and setup
- LowType entry
lib/low_type.rb - Source lookup
lib/queries/file_query.rb - Lowkey parser
- Adapter loader
lib/adapters/adapter_loader.rb - Sinatra adapter
lib/adapters/sinatra_adapter.rb
Type expressions
- Annotation evaluator
lib/definitions/evaluator.rb - Type expressions
lib/expressions/type_expression.rb - Value expressions
lib/expressions/value_expression.rb - Expression helpers
lib/expressions/expression_helpers.rb - Enumerable syntax
lib/syntax/syntax.rb - Union syntax
lib/syntax/union_types.rb - Type recognition
lib/queries/type_query.rb
Runtime checking
- Method wrappers
lib/definitions/redefiner.rb - Parameter metadata
lib/proxies/param_proxy.rb - Return metadata
lib/proxies/return_proxy.rb - Local assignment proxy
lib/proxies/local_proxy.rb - Error reporting
lib/interfaces/error_handling.rb
User-facing extensions
- Typed accessors
lib/definitions/type_accessors.rb - Complex type catalog
lib/types/complex_types.rb - HTTP status types
lib/types/status.rb
Other components
- Including class
Connections 26
- Including class → LowType entry: includes
- LowType entry → Source lookup: locates source
lib/low_type.rb - LowType entry → Lowkey parser: loads source
lib/low_type.rb - LowType entry → Annotation evaluator: evaluates annotations
lib/low_type.rb - LowType entry → Expression helpers: adds helpers
lib/low_type.rb - LowType entry → Typed accessors: adds accessors
lib/low_type.rb - LowType entry → Method wrappers: prepends wrappers
lib/low_type.rb - LowType entry → Adapter loader: loads adapter
lib/low_type.rb - Annotation evaluator → Type expressions: builds expressions
lib/definitions/evaluator.rb - Annotation evaluator → Enumerable syntax: uses syntax
lib/definitions/evaluator.rb - Annotation evaluator → Complex type catalog: uses types
lib/definitions/evaluator.rb - Annotation evaluator → HTTP status types: uses status
lib/definitions/evaluator.rb - Type expressions → Type recognition: classifies types
lib/expressions/type_expression.rb - Enumerable syntax → Type recognition: classifies syntax
lib/syntax/syntax.rb - Method wrappers → Value expressions: unwraps values
lib/definitions/redefiner.rb - Method wrappers → Parameter metadata: validates arguments
lib/definitions/redefiner.rb - Method wrappers → Return metadata: validates returns
lib/definitions/redefiner.rb - Type expressions → Parameter metadata: reports validation errors
lib/expressions/type_expression.rb - Parameter metadata → Error reporting: formats errors
lib/proxies/param_proxy.rb - Return metadata → Error reporting: formats errors
lib/proxies/return_proxy.rb - Local assignment proxy → Error reporting: formats errors
lib/proxies/local_proxy.rb - Expression helpers → Local assignment proxy: supports local typing
lib/expressions/expression_helpers.rb - LowType entry → Sinatra adapter: configures integration
- Sinatra adapter → Return metadata: checks route returns
lib/adapters/sinatra_adapter.rb - Typed accessors → Type expressions: uses annotations
lib/definitions/type_accessors.rb - Complex type catalog → HTTP status types: includes status type
lib/types/complex_types.rb