mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove unused class AttributeMethodCache
This commit is contained in:
parent
d8ac525059
commit
e944e67001
2 changed files with 0 additions and 25 deletions
|
@ -34,30 +34,6 @@ module ActiveRecord
|
||||||
|
|
||||||
BLACKLISTED_CLASS_METHODS = %w(private public protected allocate new name parent superclass)
|
BLACKLISTED_CLASS_METHODS = %w(private public protected allocate new name parent superclass)
|
||||||
|
|
||||||
class AttributeMethodCache
|
|
||||||
def initialize
|
|
||||||
@module = Module.new
|
|
||||||
@method_cache = Concurrent::Map.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def [](name)
|
|
||||||
@method_cache.compute_if_absent(name) do
|
|
||||||
safe_name = name.unpack('h*'.freeze).first
|
|
||||||
temp_method = "__temp__#{safe_name}"
|
|
||||||
ActiveRecord::AttributeMethods::AttrNames.set_name_cache safe_name, name
|
|
||||||
@module.module_eval method_body(temp_method, safe_name), __FILE__, __LINE__
|
|
||||||
@module.instance_method temp_method
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
# Override this method in the subclasses for method body.
|
|
||||||
def method_body(method_name, const_name)
|
|
||||||
raise NotImplementedError, "Subclasses must implement a method_body(method_name, const_name) method."
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class GeneratedAttributeMethods < Module; end # :nodoc:
|
class GeneratedAttributeMethods < Module; end # :nodoc:
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
module AttributeMethods
|
module AttributeMethods
|
||||||
module Read
|
module Read
|
||||||
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
|
|
Loading…
Reference in a new issue