Module: DSPy::Ext::StructDescriptions::ClassMethods
- Defined in:
- lib/dspy/ext/struct_descriptions.rb
Instance Method Summary collapse
-
#const(name, type, **kwargs) ⇒ Object
Intercepts const definitions to capture :description before Sorbet sees it.
-
#field_descriptions ⇒ Hash{Symbol => String}
Returns a hash of field names to their descriptions.
-
#prop(name, type, **kwargs) ⇒ Object
Intercepts prop definitions to capture :description before Sorbet sees it.
Instance Method Details
#const(name, type, **kwargs) ⇒ Object
Intercepts const definitions to capture :description before Sorbet sees it.
38 39 40 41 42 43 |
# File 'lib/dspy/ext/struct_descriptions.rb', line 38 def const(name, type, **kwargs) if kwargs.key?(:description) field_descriptions[name] = kwargs.delete(:description) end super(name, type, **kwargs) end |
#field_descriptions ⇒ Hash{Symbol => String}
Returns a hash of field names to their descriptions. Only fields with explicit :description kwargs are included.
33 34 35 |
# File 'lib/dspy/ext/struct_descriptions.rb', line 33 def field_descriptions @field_descriptions ||= {} end |
#prop(name, type, **kwargs) ⇒ Object
Intercepts prop definitions to capture :description before Sorbet sees it.
46 47 48 49 50 51 |
# File 'lib/dspy/ext/struct_descriptions.rb', line 46 def prop(name, type, **kwargs) if kwargs.key?(:description) field_descriptions[name] = kwargs.delete(:description) end super(name, type, **kwargs) end |