Methods
Class Public methods
new()
📝 Source code
# File activesupport/lib/active_support/dependencies.rb, line 568
def initialize
@store = Concurrent::Map.new
end
🔎 See on GitHub
Instance Public methods
clear!()
📝 Source code
# File activesupport/lib/active_support/dependencies.rb, line 598
def clear!
@store.clear
end
🔎 See on GitHub
empty?()
📝 Source code
# File activesupport/lib/active_support/dependencies.rb, line 572
def empty?
@store.empty?
end
🔎 See on GitHub
get(key)
Also aliased as: []
📝 Source code
# File activesupport/lib/active_support/dependencies.rb, line 580
def get(key)
key = key.name if key.respond_to?(:name)
@store[key] ||= Inflector.constantize(key)
end
🔎 See on GitHub
key?(key)
📝 Source code
# File activesupport/lib/active_support/dependencies.rb, line 576
def key?(key)
@store.key?(key)
end
🔎 See on GitHub
safe_get(key)
📝 Source code
# File activesupport/lib/active_support/dependencies.rb, line 586
def safe_get(key)
key = key.name if key.respond_to?(:name)
@store[key] ||= Inflector.safe_constantize(key)
end
🔎 See on GitHub
store(klass)
📝 Source code
# File activesupport/lib/active_support/dependencies.rb, line 591
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
🔎 See on GitHub