Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Whether or not Pathname + Dir on jRuby behaves differently than in MRI

Test code (run from the Documents directory of a standard OS X user account).

d ='Pictures')

pn =

dir = pn.children.find { |child| && child.basename.to_s == 'GoPro' }
puts dir.inspect

JRuby 1.7.5 result:

‼ ⚡ ruby dir_test.rb
TypeError: can't convert Dir into String
initialize at org/jruby/ext/pathname/
      (root) at dir_test.rb:7

MRI 1.9.3-p392 result:

✔ ⚡ ruby dir_test.rb


pn =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.