Module: Foobara::Domain::ModuleExtension

Included in:
Module
Defined in:
foobara-0.5.8/projects/typesystem/projects/domain/src/module_extension.rb

Overview

TODO: should we just couple domain project and commands project to simplify this connection? TODO: move this stuff to extensions/ directory

Defined Under Namespace

Classes: CannotBeOrganizationAndDomainAtSameTime

Instance Method Summary collapse

Instance Method Details

#foobara_domain!Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'projects/typesystem/projects/domain/src/module_extension.rb', line 13

def foobara_domain!
  if foobara_organization?
    # :nocov:
    raise CannotBeOrganizationAndDomainAtSameTime
    # :nocov:
  end

  unless is_a?(Namespace::IsNamespace)
    foobara_namespace!
    foobara_autoset_namespace!(default_namespace: Foobara::GlobalOrganization)
    foobara_autoset_scoped_path!

    foobara_parent_namespace.foobara_register(self)
  end

  include(DomainModuleExtension)
end

#foobara_domain?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'projects/typesystem/projects/domain/src/module_extension.rb', line 49

def foobara_domain?
  false
end

#foobara_organization!Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'projects/typesystem/projects/domain/src/module_extension.rb', line 31

def foobara_organization!
  if foobara_domain?
    # :nocov:
    raise CannotBeOrganizationAndDomainAtSameTime
    # :nocov:
  end

  include(OrganizationModuleExtension)

  unless is_a?(Namespace::IsNamespace)
    foobara_namespace!
    self.scoped_namespace = Namespace.global
    foobara_autoset_scoped_path!(make_top_level: true)

    foobara_parent_namespace.foobara_register(self)
  end
end

#foobara_organization?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'projects/typesystem/projects/domain/src/module_extension.rb', line 53

def foobara_organization?
  false
end