Module: Tins::ConstantMaker
- Defined in:
- lib/tins/dslkit.rb
Overview
This module enables dynamic constant resolution by converting missing constant references into symbols. When a constant is not found, instead of raising NameError, the constant name is returned as a symbol. This is particularly useful for creating DSLs, configuration systems, and symbolic interfaces.
Instance Method Summary collapse
-
#const_missing(id) ⇒ Symbol
Handles missing constant references by returning the constant name as a symbol.
Instance Method Details
#const_missing(id) ⇒ Symbol
Handles missing constant references by returning the constant name as a symbol.
This method is called when Ruby cannot find a constant in the current namespace. Instead of raising a NameError, it returns the constant name as a symbol, enabling symbolic constant handling throughout the application.
563 564 565 |
# File 'lib/tins/dslkit.rb', line 563 def const_missing(id) id end |