rubinius/rubinius — pull request #1794 by LTe (2012-07-04 12:34:30+00:00)
Title: Update behavior of require_relative

Ruby MRI raise LoadError with message 'cannot infer basepath from (file)'
when developer try to require_relative in 'irb'.

**MRI**

```ruby
lite@LTE-RB ~> irb
1.9.3p125 :001 > require_relative "../file"
LoadError: cannot infer basepath
from (irb):1:in `require_relative'
from (irb):1
from /home/lite/.rvm/rubies/ruby-1.9.3-p125-perf/bin/irb:16:in `

'
1.9.3p125 :002 >
```

**Rubinius before patch**

```ruby
rubinius-2.0.0dev :001 > require_relative "../file"
TypeError: Coercion error: nil.to_str => String failed
from kernel/common/type.rb:28:in `execute_coerce_to'
from kernel/common/type.rb:21:in `coerce_to'
from kernel/common/kernel.rb:28:in `StringValue'
from kernel/common/type19.rb:42:in `coerce_to_path'
from kernel/common/file.rb:325:in `dirname'
from kernel/common/codeloader19.rb:26:in `require_relative'
from kernel/common/kernel19.rb:176:in `require_relative'
from (irb):1
from kernel/common/block_environment.rb:75:in `call_on_instance'
from kernel/common/eval.rb:72:in `eval'
from kernel/common/kernel19.rb:42:in `loop'
from kernel/common/throw_catch19.rb:8:in `catch'
from kernel/common/throw_catch.rb:10:in `register'
from kernel/common/throw_catch19.rb:7:in `catch'
from kernel/common/throw_catch19.rb:8:in `catch'
from kernel/common/throw_catch.rb:10:in `register'
from kernel/common/throw_catch19.rb:7:in `catch'
from kernel/common/codeloader.rb:207:in `require'
from kernel/common/kernel.rb:631:in `gem_original_require (require)'
from /home/lite/.rvm/rubies/rbx-head/lib/rubygems/custom_require.rb:36:in `require'
from kernel/loader.rb:706:in `irb'
from kernel/loader.rb:845:in `main'rubinius-2.0.0dev :002 >
```

**Rubinius after patch**

```ruby
rubinius-2.0.0dev :001 > require_relative "../file"
LoadError: cannot infer basepath from (irb)
from kernel/common/codeloader19.rb:26:in `require_relative'
from kernel/common/kernel19.rb:176:in `require_relative'
from (irb):1
from kernel/common/block_environment.rb:75:in `call_on_instance'
from kernel/common/eval.rb:72:in `eval'
from kernel/common/kernel19.rb:42:in `loop'
from kernel/common/throw_catch19.rb:8:in `catch'
from kernel/common/throw_catch.rb:10:in `register'
from kernel/common/throw_catch19.rb:7:in `catch'
from kernel/common/throw_catch19.rb:8:in `catch'
from kernel/common/throw_catch.rb:10:in `register'
from kernel/common/throw_catch19.rb:7:in `catch'
from kernel/delta/codeloader.rb:67:in `load_script'
from kernel/delta/codeloader.rb:109:in `load_script'
from kernel/loader.rb:632:in `script'
from kernel/loader.rb:835:in `main'
```