Skip to content

Instantly share code, notes, and snippets.

@okitan
Created May 2, 2012 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okitan/2574469 to your computer and use it in GitHub Desktop.
Save okitan/2574469 to your computer and use it in GitHub Desktop.
caller使ってみた
#!/usr/bin/env ruby
$: << "."
require 'hoge'
hoge
def hoge(file = nil, line = nil)
file, line, _ = caller.first.split(":") unless file or line
puts file
puts line
end
./fuga.rb
6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment