fix for Ruby 1.8
This commit is contained in:
parent
2ba26f1bb6
commit
accea6648c
|
@ -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!
|
||||
|
|
Loading…
Reference in New Issue