Module: Mumukit::Platform::Organization
- Defined in:
- lib/mumukit/platform/organization.rb
Defined Under Namespace
Modules: Helpers
Classes: Profile, Settings, Theme
Class Method Summary
collapse
Class Method Details
11
12
13
|
# File 'lib/mumukit/platform/organization.rb', line 11
def self.current
Thread.current[:organization] || raise('organization not selected')
end
|
.current? ⇒ Boolean
15
16
17
|
# File 'lib/mumukit/platform/organization.rb', line 15
def self.current?
!!Thread.current[:organization]
end
|
.current_locale ⇒ Object
19
20
21
|
# File 'lib/mumukit/platform/organization.rb', line 19
def self.current_locale
Thread.current[:organization]&.locale || 'en'
end
|
.find_by_name!(name) ⇒ Object
23
24
25
|
# File 'lib/mumukit/platform/organization.rb', line 23
def self.find_by_name!(name)
Mumukit::Platform.organization_class.find_by_name!(name)
end
|
7
8
9
|
# File 'lib/mumukit/platform/organization.rb', line 7
def self.leave!
Thread.current[:organization] = nil
end
|
.switch!(organization) ⇒ Object
2
3
4
5
|
# File 'lib/mumukit/platform/organization.rb', line 2
def self.switch!(organization)
raise 'Organization must not be nil' unless organization
Thread.current[:organization] = organization
end
|