Make Haml::Util.caller_info work w/some weird Rubinius formatting.

This commit is contained in:
Nathan Weizenbaum 2010-05-15 02:55:01 -07:00
parent b0c6cb784f
commit c901083996
2 changed files with 3 additions and 0 deletions

View File

@ -219,6 +219,8 @@ module Haml
def caller_info(entry = caller[1])
info = entry.scan(/^(.*?):(-?.*?)(?::.*`(.+)')?$/).first
info[1] = info[1].to_i
# This is added by Rubinius to designate a block, but we don't care about it.
info[2].sub!(/ \{\}\Z/, '') if info[2]
info
end

View File

@ -211,6 +211,7 @@ class UtilTest < Test::Unit::TestCase
assert_equal(["(haml)", 12, "blah"], caller_info("(haml):12: in `blah'"))
assert_equal(["", 12, "boop"], caller_info(":12: in `boop'"))
assert_equal(["/tmp/foo.rb", -12, "fizzle"], caller_info("/tmp/foo.rb:-12: in `fizzle'"))
assert_equal(["/tmp/foo.rb", 12, "fizzle"], caller_info("/tmp/foo.rb:12: in `fizzle {}'"))
end
def test_def_static_method