Module: Mikunyan::CustomTypes

Defined in:
lib/mikunyan/base_object.rb,
lib/mikunyan/types/texture2d.rb,
lib/mikunyan/types/text_asset.rb

Defined Under Namespace

Classes: TextAsset, Texture2D

Class Method Summary collapse

Class Method Details

.get_custom_type(name, class_id = nil) ⇒ Object



20
21
22
23
# File 'lib/mikunyan/base_object.rb', line 20

def self.get_custom_type(name, class_id = nil)
  class_id ||= Mikunyan::Constants::CLASS_NAME2ID[name]
  @custom_types&.[]([class_id, name]) || Mikunyan::BaseObject
end

.set_custom_type(klass, name, class_id = nil) ⇒ Object



25
26
27
28
29
# File 'lib/mikunyan/base_object.rb', line 25

def self.set_custom_type(klass, name, class_id = nil)
  class_id ||= Mikunyan::Constants::CLASS_NAME2ID[name]
  @custom_types ||= {}
  @custom_types[[class_id, name].freeze] = klass
end