Sha256: 8179cfeabadba4c52784788cef34ee65f8a5ef652390f2620664bfdc0b60668f

Contents?: true

Size: 1.54 KB

Versions: 26

Compression:

Stored size: 1.54 KB

Contents

module Foobara
  module IsManifestable
    def scoped_clear_caches
      [
        # TODO: what about this one??
        # "@created_in_namespace",
        "@foobara_domain"
      ].each do |variable|
        remove_instance_variable(variable) if instance_variable_defined?(variable)
      end
      super
    end

    def foobara_domain
      return @foobara_domain if defined?(@foobara_domain)

      scoped = self

      while scoped
        if scoped.is_a?(::Module)
          if scoped.foobara_domain?
            return @foobara_domain = scoped
          end
        end

        scoped = scoped.scoped_namespace
      end

      @foobara_domain = GlobalDomain
    end

    def foobara_organization
      if is_a?(::Module) && foobara_organization?
        self
      else
        foobara_domain.foobara_organization
      end
    end

    def foobara_manifest(to_include: Set.new)
      h = {
        scoped_path:,
        scoped_name:,
        scoped_short_name:,
        scoped_prefix:,
        scoped_full_path:,
        scoped_full_name:,
        scoped_category:,
        reference: foobara_manifest_reference,
        domain: foobara_domain&.foobara_manifest_reference,
        organization: foobara_organization&.foobara_manifest_reference
      }

      parent = scoped_namespace

      if parent
        parent_category = Namespace.global.foobara_category_symbol_for(parent)

        if parent_category
          to_include << parent
          h[:parent] = [parent_category, parent.foobara_manifest_reference]
        end
      end

      h
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
foobara-0.0.26 projects/domain/src/is_manifestable.rb
foobara-0.0.25 projects/domain/src/is_manifestable.rb
foobara-0.0.24 projects/domain/src/is_manifestable.rb
foobara-0.0.23 projects/domain/src/is_manifestable.rb
foobara-0.0.22 projects/domain/src/is_manifestable.rb
foobara-0.0.21 projects/domain/src/is_manifestable.rb
foobara-0.0.20 projects/domain/src/is_manifestable.rb
foobara-0.0.19 projects/domain/src/is_manifestable.rb
foobara-0.0.18 projects/domain/src/is_manifestable.rb
foobara-0.0.17 projects/domain/src/is_manifestable.rb
foobara-0.0.16 projects/domain/src/is_manifestable.rb
foobara-0.0.15 projects/domain/src/is_manifestable.rb
foobara-0.0.14 projects/domain/src/is_manifestable.rb
foobara-0.0.13 projects/domain/src/is_manifestable.rb
foobara-0.0.12 projects/domain/src/is_manifestable.rb
foobara-0.0.11 projects/domain/src/is_manifestable.rb
foobara-0.0.10 projects/domain/src/is_manifestable.rb
foobara-0.0.9 projects/domain/src/is_manifestable.rb
foobara-0.0.8 projects/domain/src/is_manifestable.rb
foobara-0.0.7 projects/domain/src/is_manifestable.rb