fix for Ruby 1.8

This commit is contained in:
maul.esel 2013-09-11 17:27:34 +02:00
parent 2ba26f1bb6
commit accea6648c
1 changed files with 14 additions and 0 deletions

View File

@ -52,6 +52,20 @@ class Hash
def symbolize_keys
dup.symbolize_keys!
end
if RUBY_VERSION < '1.9'
attr_accessor :default_proc
def [](key)
fetch(key) do |key|
if @default_proc.nil?
default(key)
else
@default_proc.call(self, key)
end
end
end
end
end
# Thanks, ActiveSupport!