Module: Mumukit::Platform::PathMapping
- Defined in:
- lib/mumukit/platform/path_mapping.rb
Class Method Summary collapse
- .implicit_organization?(_request, _domain) ⇒ Boolean
- .inorganic_path_for(request) ⇒ Object
- .map_organization_routes!(native, framework, &block) ⇒ Object
- .organic_uri(uri, organization) ⇒ Object
- .organization_name(request, _domain) ⇒ Object
- .path_composition_for(request) ⇒ Object
- .path_for(request) ⇒ Object
- .path_under_namespace?(organization_name, path, namespace) ⇒ Boolean
Class Method Details
.implicit_organization?(_request, _domain) ⇒ Boolean
8 9 10 |
# File 'lib/mumukit/platform/path_mapping.rb', line 8 def self.implicit_organization?(_request, _domain) false end |
.inorganic_path_for(request) ⇒ Object
25 26 27 |
# File 'lib/mumukit/platform/path_mapping.rb', line 25 def self.inorganic_path_for(request) path_composition_for(request).second end |
.map_organization_routes!(native, framework, &block) ⇒ Object
12 13 14 |
# File 'lib/mumukit/platform/path_mapping.rb', line 12 def self.map_organization_routes!(native, framework, &block) framework.configure_tenant_path_routes! native, &block end |
.organic_uri(uri, organization) ⇒ Object
29 30 31 |
# File 'lib/mumukit/platform/path_mapping.rb', line 29 def self.organic_uri(uri, organization) uri.tenantize organization, fragmented: true end |
.organization_name(request, _domain) ⇒ Object
21 22 23 |
# File 'lib/mumukit/platform/path_mapping.rb', line 21 def self.organization_name(request, _domain) path_composition_for(request).first end |
.path_composition_for(request) ⇒ Object
16 17 18 19 |
# File 'lib/mumukit/platform/path_mapping.rb', line 16 def self.path_composition_for(request) organization, *path_parts = Pathname(path_for(request)).each_filename.to_a [organization, path_parts.join('/')] end |
.path_for(request) ⇒ Object
4 5 6 |
# File 'lib/mumukit/platform/path_mapping.rb', line 4 def self.path_for(request) request.path_info end |
.path_under_namespace?(organization_name, path, namespace) ⇒ Boolean
33 34 35 |
# File 'lib/mumukit/platform/path_mapping.rb', line 33 def self.path_under_namespace?(organization_name, path, namespace) path.start_with? "/#{organization_name}/#{namespace}/" end |