Sha256: 95fe69ceda3829d51c0289eb7732a539193958bb276d71f24b43a6830d75906c

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

module PowerStencil
  module SystemEntityDefinitions

    module EntityProjectCommon

      def save(uri = source_uri, raise_error: true, force_save: false, force_files_generation: false )
        super(source_uri, raise_error: raise_error, force_save: force_save)
        unless PowerStencil.project.entity_type_templates[type].nil?
          PowerStencil.project.generate_entity_dir_for_entity self, force: force_files_generation
        end
        self
      end

      def delete(force_files_deletion: false)
        unless PowerStencil.project.entity_type_templates[type].nil?
          PowerStencil.project.delete_entity_dir_for_entity self, force: force_files_deletion
        end
        super()
        self
      end

      def buildable_by
        self.class.buildable_by
      end

      def buildable?
        self.class.buildable?
      end

      protected

      def project_engine
        PowerStencil.project.engine
      end

      def create_universe_entity(type, fields = {})
        project_engine.new_entity project_engine.root_universe, type, fields: fields
      end

      def remove_entity_from_universe(entity)
        project_engine.root_universe.delete entity
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
power_stencil-0.6.3 lib/power_stencil/system_entity_definitions/entity_project_common.rb
power_stencil-0.6.2 lib/power_stencil/system_entity_definitions/entity_project_common.rb