Permalink
Browse files

Fixed indifferent access in Config object.

  • Loading branch information...
rahmal committed May 1, 2012
1 parent 1154da4 commit aa47bd561484ff7ecb68c33cea6a9ad22a841346
Showing with 14 additions and 1 deletion.
  1. +4 −0 ChangeLog
  2. +1 −1 lib/rconfig.rb
  3. +9 −0 lib/rconfig/config.rb
View
@@ -1,3 +1,7 @@
+0.4.2
+=====
+* Fixed indifferent access in Config object.
+
0.4.1
=====
* Fixed error occuring in non-Rails apps (NameError/HashWithIndifferentAccess missing) - From vandries/rconfig (github)
View
@@ -65,7 +65,7 @@
require 'rconfig/core_ext/nil'
module RConfig
- VERSION = '0.4.1'
+ VERSION = '0.4.2'
autoload :Socket, 'socket'
autoload :YAML, 'yaml'
View
@@ -53,6 +53,15 @@ def method_missing(method, *args)
end
end
+ ##
+ # Why the &*#^@*^&$ isn't HashWithIndifferentAccess doing this?
+ # HashWithIndifferentAccess doesn't override Hash's []! That's
+ # why it's so destructive!
+ def [](key)
+ key = key.to_s if key.kind_of?(Symbol)
+ super(key)
+ end
+
##
# Allow hash.default => hash['default']
# without breaking Hash's usage of default(key)

0 comments on commit aa47bd5

Please sign in to comment.