From: Christer Nilsson Date: 2005-12-07T00:01:09+09:00 Subject: Re: How can I find __LINE__ on the execution stack ? bob.news wrote: > You can use caller[0] to get the info you want: > > irb(main):007:0> def test > irb(main):008:1> p caller[0] > irb(main):009:1> end > => nil > irb(main):010:0> test > "(irb):10:in `irb_binding'" > => nil > > Kind regards > > robert Thank you Robert! def assert(expect, actual, *msg) expect==actual ? print(".") : print("\nAssert failed: #{expect.inspect} <> #{actual.inspect} in line #{caller[0].split('\\').last} #{msg}\n") end Christer -- Posted via http://www.ruby-forum.com/.