Sha256: be899608fe3274cc1a2b58a239077140b769b1697a97d1aa0faba147d7ee24ed
Contents?: true
Size: 948 Bytes
Versions: 19
Compression:
Stored size: 948 Bytes
Contents
module UniverseCompiler module Entity module TypeManagement module ClassMethods def entity_type(value = nil) if value.nil? @entity_type || name.underscore else self.entity_type = value end end def entity_type=(value) raise UniverseCompiler::Error, "You cannot change an entity type for class '#{self.name}'" unless @entity_type.nil? raise UniverseCompiler::Error, 'Only Symbol is supported for entity_type !' unless value.is_a? Symbol @entity_type = value end end def self.valid_for_type?(entity) entity.respond_to? :type and entity.class.respond_to? :entity_type end def type self.class.entity_type end def self.included(base) base.extend(ClassMethods) end def self.extended(base) included base.class end end end end
Version data entries
19 entries across 19 versions & 1 rubygems