Source: show | on GitHub
# File activesupport/lib/active_support/dependencies.rb, line 540 def initialize @store = Hash.new end
# File activesupport/lib/active_support/dependencies.rb, line 573 def clear! @store.clear end
# File activesupport/lib/active_support/dependencies.rb, line 544 def empty? @store.empty? end
# File activesupport/lib/active_support/dependencies.rb, line 552 def get(key) key = key.name if key.respond_to?(:name) @store[key] ||= Inflector.constantize(key) end
# File activesupport/lib/active_support/dependencies.rb, line 548 def key?(key) @store.key?(key) end
# File activesupport/lib/active_support/dependencies.rb, line 558 def safe_get(key) key = key.name if key.respond_to?(:name) @store[key] || begin klass = Inflector.safe_constantize(key) @store[key] = klass end end
# File activesupport/lib/active_support/dependencies.rb, line 566 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