Sha256: 362b8e8d92a787e0e99ec005c7ae4e06f595e3d5d5ae623e741aff3b58682153

Contents?: true

Size: 1.49 KB

Versions: 14

Compression:

Stored size: 1.49 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
        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

14 entries across 14 versions & 1 rubygems

Version Path
universe_compiler-0.3.12 lib/universe_compiler/entity.rb
universe_compiler-0.3.11 lib/universe_compiler/entity.rb
universe_compiler-0.3.10 lib/universe_compiler/entity.rb
universe_compiler-0.3.9 lib/universe_compiler/entity.rb
universe_compiler-0.3.8 lib/universe_compiler/entity.rb
universe_compiler-0.3.7 lib/universe_compiler/entity.rb
universe_compiler-0.3.6 lib/universe_compiler/entity.rb
universe_compiler-0.3.5 lib/universe_compiler/entity.rb
universe_compiler-0.3.4 lib/universe_compiler/entity.rb
universe_compiler-0.3.3 lib/universe_compiler/entity.rb
universe_compiler-0.3.2 lib/universe_compiler/entity.rb
universe_compiler-0.3.1 lib/universe_compiler/entity.rb
universe_compiler-0.3.0 lib/universe_compiler/entity.rb
universe_compiler-0.2.16 lib/universe_compiler/entity.rb