Methods

Class Public methods

new()

# File activesupport/lib/active_support/dependencies.rb, line 613
def initialize
  @store = Concurrent::Map.new
end

Instance Public methods

[](key)

Alias for: get

clear!()

# File activesupport/lib/active_support/dependencies.rb, line 643
def clear!
  @store.clear
end

empty?()

# File activesupport/lib/active_support/dependencies.rb, line 617
def empty?
  @store.empty?
end

get(key)

Also aliased as: []
# File activesupport/lib/active_support/dependencies.rb, line 625
def get(key)
  key = key.name if key.respond_to?(:name)
  @store[key] ||= Inflector.constantize(key)
end

key?(key)

# File activesupport/lib/active_support/dependencies.rb, line 621
def key?(key)
  @store.key?(key)
end

safe_get(key)

# File activesupport/lib/active_support/dependencies.rb, line 631
def safe_get(key)
  key = key.name if key.respond_to?(:name)
  @store[key] ||= Inflector.safe_constantize(key)
end

store(klass)

# File activesupport/lib/active_support/dependencies.rb, line 636
def store(klass)
  return self unless klass.respond_to?(:name)
  raise(ArgumentError, "anonymous classes cannot be cached") if klass.name.empty?
  @store[klass.name] = klass
  self
end