Module: Foobara::TypeDeclarations::LazyElementTypes::Hash
- Defined in:
- foobara-0.1.7/projects/type_declarations/src/lazy_element_types/hash.rb
Overview
Using Hash instead of AssociativeArray to avoid making a symbol for it (probably doesn’t really matter)
Class Method Summary collapse
Class Method Details
.resolve(type) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'foobara-0.1.7/projects/type_declarations/src/lazy_element_types/hash.rb', line 9 def resolve(type) declaration_data = type.declaration_data key_type_declaration = declaration_data[:key_type_declaration] value_type_declaration = declaration_data[:value_type_declaration] type.element_types = if key_type_declaration || value_type_declaration TypeDeclarations.strict do domain = Domain.current key_declaration = if key_type_declaration domain.(key_type_declaration) else BuiltinTypes[:duck] end value_declaration = if value_type_declaration domain.(value_type_declaration) else BuiltinTypes[:duck] end [key_declaration, value_declaration] end end end |