class SettingsRails::Cache

Public Class Methods

add(key, setting) click to toggle source
# File lib/settings_rails/cache.rb, line 7
def self.add(key, setting)
  instance.store[key] = setting
end
each(&block) click to toggle source
# File lib/settings_rails/cache.rb, line 15
def self.each(&block)
  instance.store.each(&block)
end
fetch(key) click to toggle source
# File lib/settings_rails/cache.rb, line 3
def self.fetch(key)
  instance.fetch(key)
end
instance() click to toggle source
# File lib/settings_rails/cache.rb, line 11
def self.instance
  RequestStore.store['settings_rails.cache'] ||= new
end

Public Instance Methods

fetch(key) click to toggle source
# File lib/settings_rails/cache.rb, line 19
def fetch(key)
  store[key]
end
store() click to toggle source
# File lib/settings_rails/cache.rb, line 23
def store
  @store ||= SettingsRails::Setting.all.each_with_object({}.with_indifferent_access) do |setting, hash|
    hash[setting.key] = setting
  end
end