Sha256: 68c1856594bb01c57a4878e76d58e4ad071e0f9cadc0fdaff397c192e29b7e12

Contents?: true

Size: 822 Bytes

Versions: 9

Compression:

Stored size: 822 Bytes

Contents

module ActiveScaffold
  class Registry
    thread_mattr_accessor :current_user_proc, :current_ability_proc, :marked_records

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

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

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

    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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
active_scaffold-3.7.11 lib/active_scaffold/registry.rb
active_scaffold-3.7.10 lib/active_scaffold/registry.rb
active_scaffold-3.7.8 lib/active_scaffold/registry.rb
active_scaffold-3.7.7 lib/active_scaffold/registry.rb
active_scaffold-3.7.6 lib/active_scaffold/registry.rb
active_scaffold-3.7.5 lib/active_scaffold/registry.rb
active_scaffold-3.7.2 lib/active_scaffold/registry.rb
active_scaffold-3.7.1 lib/active_scaffold/registry.rb
active_scaffold-3.7.0 lib/active_scaffold/registry.rb