mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-04 21:01:27 -05:00
8fc2549873
Simplify local process site setting provider Stop setting up methods over and over Centralize cache clearing
38 lines
630 B
Ruby
38 lines
630 B
Ruby
module SiteSettings; end
|
|
|
|
class SiteSettings::LocalProcessProvider
|
|
|
|
attr_accessor :current_site
|
|
|
|
Setting = Struct.new(:name, :value, :data_type) unless defined? SiteSettings::LocalProcessProvider::Setting
|
|
|
|
def settings
|
|
@settings[current_site] ||= {}
|
|
end
|
|
|
|
def initialize()
|
|
@settings = {}
|
|
self.current_site = "test"
|
|
end
|
|
|
|
def all
|
|
settings.values
|
|
end
|
|
|
|
def find(name)
|
|
settings[name]
|
|
end
|
|
|
|
def save(name, value, data_type)
|
|
settings[name] = Setting.new(name,value, data_type)
|
|
end
|
|
|
|
def destroy(name)
|
|
settings.delete(name)
|
|
end
|
|
|
|
def clear
|
|
@settings[current_site] = {}
|
|
end
|
|
|
|
end
|