Created
May 2, 2012 06:32
-
-
Save okitan/2574469 to your computer and use it in GitHub Desktop.
caller使ってみた
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
$: << "." | |
require 'hoge' | |
hoge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hoge(file = nil, line = nil) | |
file, line, _ = caller.first.split(":") unless file or line | |
puts file | |
puts line | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./fuga.rb | |
6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment