Module: RequireRelative
- Defined in:
- lib/version.rb,
lib/require_relative.rb
Constant Summary collapse
- VERSION =
'0.0.9'
Class Method Summary collapse
Class Method Details
.abs_file ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/require_relative.rb', line 8 def abs_file if defined?(RubyVM::ThreadFrame) RubyVM::ThreadFrame.current.prev.source_container[1] elsif defined?(Rubinius) && "1.8.7" == RUBY_VERSION scope = Rubinius::StaticScope.of_sender script = scope.current_script if script script.data_path else nil end else file = caller.first.split(/:\d/,2).first if /\A\((.*)\)/ =~ file # eval, etc. nil end File.(file) end end |