提交 2e6f6ced 编写于 作者: J Jeremy Kemper

r1300@iwill: jeremy | 2005-06-13 18:31:29 -0700

 Ticket 1436 - Faster indifferent hash
 r1301@iwill:  jeremy | 2005-06-13 18:45:28 -0700
 Apply, tweak, test.
 r1305@iwill:  jeremy | 2005-06-13 18:50:24 -0700
 Updated changelog.


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1413 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 37a370d8
*SVN*
* Increased the speed of indifferent hash access by using Hash#default. #1436 [Nicholas Seckar]
* Added that " " is now also blank? (using strip if available)
* Fixed Dependencies so all modules are able to load missing constants #1173 [Nicholas Seckar]
......
......@@ -9,14 +9,8 @@ def initialize(constructor = {})
end
end
alias_method :regular_reader, :[] unless method_defined?(:regular_reader)
def [](key)
case key
when Symbol: regular_reader(key.to_s) || regular_reader(key)
when String: regular_reader(key) || regular_reader(key.to_sym)
else regular_reader(key)
end
def default(key)
self[key.to_s] if key.is_a?(Symbol)
end
alias_method :regular_writer, :[]= unless method_defined?(:regular_writer)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册