Module: Foobara::Organization
- Defined in:
- foobara-0.1.7/projects/domain/src/organization.rb
Defined Under Namespace
Classes: NoSuchOrganization, OrganizationAlreadyExistsError
Class Method Summary
collapse
Class Method Details
.create(full_organization_name) ⇒ Object
.to_organization(object) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'foobara-0.1.7/projects/domain/src/organization.rb', line 7
def to_organization(object)
case object
when nil
GlobalOrganization
when ::String, ::Symbol
organization = Namespace.global.foobara_lookup_organization(object)
unless organization
raise NoSuchOrganization, "Couldn't determine organization for #{object}"
end
organization
when Foobara::Scoped
if object.is_a?(Module) && object.foobara_organization?
object
else
parent = object.scoped_namespace
if parent
to_organization(parent)
else
GlobalOrganization
end
end
else
raise NoSuchOrganization, "Couldn't determine organization for #{object}"
end
end
|