Sha256: 1d3db3f2df93dfd2f8b6b512654537fe0b646db59c7a8786a2de190149f16961

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

module UniverseCompiler
  module Entity

    class Base

      include UniverseCompiler::Utils::ErrorPropagation
      include UniverseCompiler::Utils::DeepTraverse
      include UniverseCompiler::Entity::TypeManagement
      include UniverseCompiler::Entity::FieldManagement
      extend UniverseCompiler::Entity::AutoNamed
      extend UniverseCompiler::Entity::FieldConstraintManagement
      extend UniverseCompiler::Entity::RelationsManagement
      extend UniverseCompiler::Entity::FieldBinder
      include UniverseCompiler::Entity::Validation
      include UniverseCompiler::Entity::Marshalling
      include UniverseCompiler::Entity::Inheritance
      include UniverseCompiler::Entity::Conversion
      include UniverseCompiler::Entity::Overridden
      include UniverseCompiler::Entity::Persistence

      attr_reader :fields
      attr_accessor :universe

      field_accessor :name

      def initialize(fields: {}, universe: nil)
        @fields = fields
        define_known_fields_accessors
        define_reverse_methods
        self.universe = universe
        self.fully_resolved = true
        if universe.nil?
          self.name = self.class.get_unique_name(nil) if self.class.auto_named_entity_type?
        else
          unless universe.compiled?
            self.name = self.class.get_unique_name(universe) if self.class.auto_named_entity_type?
          end
        end
      end

      def [](key)
        fields[key]
      end

      def []=(key, value)
        fields[key] = value
      end

    end

  end
end



















Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
universe_compiler-0.5.1 lib/universe_compiler/entity.rb
universe_compiler-0.4.3 lib/universe_compiler/entity.rb
universe_compiler-0.4.2 lib/universe_compiler/entity.rb
universe_compiler-0.4.1 lib/universe_compiler/entity.rb
universe_compiler-0.4.0 lib/universe_compiler/entity.rb