2013-06-22 22:35:06 -05:00
|
|
|
module SiteSettings; end
|
|
|
|
|
|
|
|
class SiteSettings::LocalProcessProvider
|
|
|
|
|
2014-03-28 00:36:17 -05:00
|
|
|
attr_accessor :current_site
|
|
|
|
|
2013-07-04 01:49:17 -05:00
|
|
|
Setting = Struct.new(:name, :value, :data_type) unless defined? SiteSettings::LocalProcessProvider::Setting
|
2013-06-22 22:35:06 -05:00
|
|
|
|
2014-03-28 00:36:17 -05:00
|
|
|
def settings
|
|
|
|
@settings[current_site] ||= {}
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize()
|
2013-06-22 22:35:06 -05:00
|
|
|
@settings = {}
|
2014-03-28 00:36:17 -05:00
|
|
|
self.current_site = "test"
|
2013-06-22 22:35:06 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def all
|
2014-03-28 00:36:17 -05:00
|
|
|
settings.values
|
2013-06-22 22:35:06 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def find(name)
|
2014-03-28 00:36:17 -05:00
|
|
|
settings[name]
|
2013-06-22 22:35:06 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def save(name, value, data_type)
|
2014-03-28 00:36:17 -05:00
|
|
|
settings[name] = Setting.new(name,value, data_type)
|
2013-06-22 22:35:06 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy(name)
|
2014-03-28 00:36:17 -05:00
|
|
|
settings.delete(name)
|
2013-06-22 22:35:06 -05:00
|
|
|
end
|
|
|
|
|
2014-03-28 00:36:17 -05:00
|
|
|
def clear
|
|
|
|
@settings[current_site] = {}
|
2013-06-22 22:35:06 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|