rubysl/rubysl-pathname — pull request #3 by BennyKlotz (2014-07-16 23:03:26+00:00)
Title: Define a public Kernel.Pathname method

Different behaviour of Kernel.Pathname on mri and rbx

On mri 2.1.2:
```bash
irb(main):001:0> require 'pathname'
=> true
irb(main):002:0> Kernel.Pathname('/')
=> #
irb(main):003:0>
```

On rbx 2.2.10:
```bash
irb(main):001:0> require 'pathname'
=> true
irb(main):002:0> Kernel.Pathname('/')
NoMethodError: private method `Pathname' called on Kernel (Module)
from kernel/delta/kernel.rb:78:in `Pathname (method_missing)'
from (irb):2
from kernel/common/block_environment.rb:53:in `call_on_instance'
from kernel/common/eval.rb:176:in `eval'
from kernel/common/kernel.rb:468:in `loop'
from kernel/bootstrap/proc.rb:20:in `call'
from kernel/common/throw_catch.rb:30:in `catch'
from kernel/common/throw_catch.rb:8:in `register'
from kernel/common/throw_catch.rb:29:in `catch'
from kernel/bootstrap/proc.rb:20:in `call'
from kernel/common/throw_catch.rb:30:in `catch'
from kernel/common/throw_catch.rb:8:in `register'
from kernel/common/throw_catch.rb:29:in `catch'
from /home/benny/.rubies/rbx/gems/gems/rubysl-irb-2.0.4/bin/irb:12:in `__script__'
from kernel/common/kernel.rb:455:in `load'
from /home/benny/.rubies/rbx/gems/bin/irb:23:in `__script__'
from kernel/delta/code_loader.rb:66:in `load_script'
from kernel/delta/code_loader.rb:152:in `load_script'
from kernel/loader.rb:649:in `script'
from kernel/loader.rb:827:in `main'irb(main):003:0>
```
I did some digging and in https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L1462 Kernel Pathname is defined via ```rb_define_global_function```, this futhermore uses ```rb_define_private_method``` and ```rb_define_singleton_method```.

This defines a private Kernel#Pathname and a public Kernel.Pathname.

So my suggestion would be:
```ruby
module Kernel
# create a pathname object.
#
# This method is available since 1.8.5.
def Pathname(path) # :doc:
Pathname.new(path)
end
private :Pathname

def self.Pathname(path)
Pathname.new(path)
end
end
```

This would (like in mri) define a private Kernel#Pathname method and a public Kernel.Pathname method. Correct me if I got something wrong :)