Class: ActiveScaffold::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/active_scaffold/registry.rb

Class Method Summary collapse

Class Method Details

.cache(kind, key = nil, &block) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/active_scaffold/registry.rb', line 17

def self.cache(kind, key = nil, &block)
  unless key
    key = kind
    kind = :cache
  end
  RequestStore.store[:attr_Registry_cache] ||= {}
  cache = RequestStore.store[:attr_Registry_cache][kind] ||= {}
  return cache[key] if cache.include? key
  cache[key] ||= yield
end

.constraint_columnsObject



9
10
11
# File 'lib/active_scaffold/registry.rb', line 9

def self.constraint_columns
  RequestStore.store[:attr_Registry_constraint_columns] ||= Hash.new { |h, k| h[k] = [] }
end

.unauthorized_columnsObject



13
14
15
# File 'lib/active_scaffold/registry.rb', line 13

def self.unauthorized_columns
  RequestStore.store[:attr_Registry_unauthorized_columns] ||= Hash.new { |h, k| h[k] = [] }
end

.user_settingsObject



5
6
7
# File 'lib/active_scaffold/registry.rb', line 5

def self.
  RequestStore.store[:attr_Registry_user_settings] ||= {}
end