Permalink
Browse files

Fix 1.8.x regression (implement Ruby1.9's Hash#key)

  • Loading branch information...
1 parent cd0a4a1 commit 26091e425f7a687055e0a4f7585a6e18d6348d9b @lsegal committed Jul 9, 2009
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/tadpole/template.rb
View
@@ -7,6 +7,14 @@ def to_hash; @table.dup end
alias has_key? respond_to?
end
+if RUBY_VERSION < "1.9"
+ class Hash
+ def key(value)
+ each {|k, v| return k if v == value }
+ end
+ end
+end
+
module Tadpole
module Template
class MissingSectionError < Exception; end

0 comments on commit 26091e4

Please sign in to comment.