Skip to content

Commit

Permalink
Make Haml::Util.caller_info work w/some weird Rubinius formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed May 15, 2010
1 parent b0c6cb7 commit c901083
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/haml/util.rb
Expand Up @@ -219,6 +219,8 @@ def lcs(x, y, &block)
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

Expand Down
1 change: 1 addition & 0 deletions test/haml/util_test.rb
Expand Up @@ -211,6 +211,7 @@ def test_caller_info
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
Expand Down

0 comments on commit c901083

Please sign in to comment.