Sha256: 7f4034dbb184cae5d1008b12baabe9f0eddd560137a64f16ba6c7d772ca12047

Contents?: true

Size: 1.22 KB

Versions: 7

Compression:

Stored size: 1.22 KB

Contents

require_relative "manifestable"

module Foobara
  module Domain
    module OrganizationModuleExtension
      # Does this really need to be a Concern?
      include Concern
      include Manifestable

      module ClassMethods
        attr_writer :foobara_organization_name, :foobara_full_organization_name

        def foobara_organization_name
          @foobara_organization_name || scoped_name
        end

        def foobara_full_organization_name
          @foobara_full_organization_name || scoped_full_name
        end

        def foobara_organization?
          true
        end

        def foobara_owns_domain?(domain)
          foobara_each_domain(mode: Namespace::LookupMode::DIRECT) do |d|
            if d == domain || (d == domain.mod if domain.respond_to?(:mod))
              return true
            end
          end

          false
        end

        def foobara_domains
          foobara_all_domain(mode: Namespace::LookupMode::DIRECT)
        end

        def foobara_manifest(to_include: Set.new)
          domains = foobara_domains.map do |domain|
            to_include << domain
            domain.foobara_manifest_reference
          end.sort

          super.merge(domains:)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
foobara-0.0.27 projects/domain/src/organization_module_extension.rb
foobara-0.0.26 projects/domain/src/organization_module_extension.rb
foobara-0.0.25 projects/domain/src/organization_module_extension.rb
foobara-0.0.24 projects/domain/src/organization_module_extension.rb
foobara-0.0.23 projects/domain/src/organization_module_extension.rb
foobara-0.0.22 projects/domain/src/organization_module_extension.rb
foobara-0.0.21 projects/domain/src/organization_module_extension.rb