Module: Foobara::Organization
- Defined in:
- foobara-0.0.110/projects/domain/src/organization.rb
Defined Under Namespace
Classes: NoSuchOrganization, OrganizationAlreadyExistsError
Class Method Summary collapse
- .create(full_organization_name) ⇒ Object
-
.to_organization(object) ⇒ Object
TODO: move this to organization.rb.
Class Method Details
.create(full_organization_name) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'foobara-0.0.110/projects/domain/src/organization.rb', line 41 def create(full_organization_name) if Organization.to_organization(full_organization_name) # :nocov: raise OrganizationAlreadyExistsError, "Organization #{full_organization_name} already exists" # :nocov: end rescue Organization::NoSuchOrganization Util.make_module_p(full_organization_name) { } end |
.to_organization(object) ⇒ Object
TODO: move this to organization.rb
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 39 |
# File 'foobara-0.0.110/projects/domain/src/organization.rb', line 8 def to_organization(object) case object when nil GlobalOrganization when ::String, ::Symbol organization = Namespace.global.(object) unless organization # :nocov: raise NoSuchOrganization, "Couldn't determine organization for #{object}" # :nocov: end organization when Foobara::Scoped if object.is_a?(Module) && object. object else parent = object.scoped_namespace if parent to_organization(parent) else GlobalOrganization end end else # :nocov: raise NoSuchOrganization, "Couldn't determine organization for #{object}" # :nocov: end end |