Module: HDLRuby::Low::Low2Symbol
- Included in:
- Behavior, Code, Delay, Event, Expression, Scope, SignalI, Statement, SystemI, SystemT, Type, When
- Defined in:
- lib/HDLRuby/hruby_low2sym.rb
Overview
Module adding the conversion to symbol feature to HDLRuby objects.
Constant Summary collapse
- Low2SymbolTable =
The correspondance tables between HDLRuby objects and symbols.
{}
- Symbol2LowTable =
{}
- Low2SymbolPrefix =
The prefix used when building symbols.
"`"
Instance Method Summary collapse
-
#to_sym ⇒ Object
Converts to a symbol.
Instance Method Details
#to_sym ⇒ Object
Converts to a symbol.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/HDLRuby/hruby_low2sym.rb', line 30 def to_sym # Get the associated symbol if any. @_symbol_equiv ||= Low2SymbolTable[self] unless @_symbol_equiv then # No symbol yet, create it. @_symbol_equiv = (Low2SymbolPrefix + Symbol2LowTable.size.to_s).to_sym # And regiter it. Symbol2LowTable[@_symbol_equiv] = self Low2SymbolTable[self] = @_symbol_equiv end # Now there is a symbol, return it. return @_symbol_equiv end |