Sha256: e194d3dddbeff9370868be91d4e0990633d34ab0fa03c1f7acc264f007a05b5c

Contents?: true

Size: 1.21 KB

Versions: 20

Compression:

Stored size: 1.21 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:)
          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

20 entries across 20 versions & 1 rubygems

Version Path
foobara-0.0.20 projects/domain/src/organization_module_extension.rb
foobara-0.0.19 projects/domain/src/organization_module_extension.rb
foobara-0.0.18 projects/domain/src/organization_module_extension.rb
foobara-0.0.17 projects/domain/src/organization_module_extension.rb
foobara-0.0.16 projects/domain/src/organization_module_extension.rb
foobara-0.0.15 projects/domain/src/organization_module_extension.rb
foobara-0.0.14 projects/domain/src/organization_module_extension.rb
foobara-0.0.13 projects/domain/src/organization_module_extension.rb
foobara-0.0.12 projects/domain/src/organization_module_extension.rb
foobara-0.0.11 projects/domain/src/organization_module_extension.rb
foobara-0.0.10 projects/domain/src/organization_module_extension.rb
foobara-0.0.9 projects/domain/src/organization_module_extension.rb
foobara-0.0.8 projects/domain/src/organization_module_extension.rb
foobara-0.0.7 projects/domain/src/organization_module_extension.rb
foobara-0.0.6 projects/domain/src/organization_module_extension.rb
foobara-0.0.5 projects/domain/src/organization_module_extension.rb
foobara-0.0.4 projects/domain/src/organization_module_extension.rb
foobara-0.0.3 projects/domain/src/organization_module_extension.rb
foobara-0.0.2 projects/domain/src/organization_module_extension.rb
foobara-0.0.1 projects/domain/src/organization_module_extension.rb