提交 9f76531c 编写于 作者: A Aaron Patterson

push attribute constant cache in to the attribute methods module

上级 79b88e87
......@@ -26,7 +26,15 @@ def inherited(child_class) #:nodoc:
end
def initialize_generated_modules # :nodoc:
@generated_attribute_methods = Module.new { extend Mutex_m }
@generated_attribute_methods = Module.new {
extend Mutex_m
const_set :AttrNames, Module.new {
def self.const_missing(name)
const_set(name, [name.to_s.sub(/ATTR_/, '')].pack('h*').freeze)
end
}
}
@attribute_methods_generated = false
include @generated_attribute_methods
end
......
......@@ -90,12 +90,6 @@ def self.connection_handler=(handler)
module ClassMethods
def initialize_generated_modules
super
# force attribute methods to be higher in inheritance hierarchy than other generated methods
generated_attribute_methods.const_set(:AttrNames, Module.new {
def self.const_missing(name)
const_set(name, [name.to_s.sub(/ATTR_/, '')].pack('h*').freeze)
end
})
generated_feature_methods
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册