Class: HatiConfig::TypeMap
- Inherits:
-
Object
- Object
- HatiConfig::TypeMap
- Defined in:
- lib/hati_config/type_map.rb
Overview
A class that maps type symbols to their corresponding Ruby classes and provides predefined collections of type symbols for various categories.
This class allows retrieval of Ruby classes based on type symbols and provides methods to access collections of specific type symbols such as booleans, numerics, and chronological types.
Constant Summary collapse
- TYPE_MAP =
{ # base types int: Integer, integer: Integer, str: String, string: String, sym: Symbol, null: NilClass, true_class: TrueClass, false_class: FalseClass, # data structures hash: Hash, array: Array, # numeric types big_decimal: BigDecimal, float: Float, complex: Complex, rational: Rational, # time types date: Date, date_time: DateTime, time: Time, # any type any: Object, # composite types bool: %i[true_class false_class], numeric: %i[int float big_decimal], kernel_num: %i[int float big_decimal complex rational], chrono: %i[date date_time time] }.freeze
Class Method Summary collapse
-
.get(type) ⇒ Class?
Retrieves the Ruby class associated with a given type symbol.
-
.list_types ⇒ Array<Symbol>
Returns an array of all type symbols defined in TYPE_MAP.
Class Method Details
.get(type) ⇒ Class?
Retrieves the Ruby class associated with a given type symbol.
55 56 57 |
# File 'lib/hati_config/type_map.rb', line 55 def self.get(type) TYPE_MAP[type] end |
.list_types ⇒ Array<Symbol>
Returns an array of all type symbols defined in TYPE_MAP.
68 69 70 |
# File 'lib/hati_config/type_map.rb', line 68 def self.list_types TYPE_MAP.keys end |