提交 3da9a08a 编写于 作者: J José Valim

Optimize DetailsKey generation.

上级 c8f1aac7
......@@ -38,17 +38,18 @@ module Setters #:nodoc:
register_detail(:locale) { [I18n.locale] }
class DetailsKey #:nodoc:
attr_reader :details
alias :eql? :equal?
alias :object_hash :hash
attr_reader :hash
@details_keys = Hash.new
def self.get(details)
@details_keys[details] ||= new(details)
@details_keys[details] ||= new
end
def initialize(details)
@details, @hash = details, details.hash
def initialize
@hash = object_hash
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册