public
Last active

  • Download Gist
console.log
1 2 3 4 5 6 7 8 9 10 11 12 13
~$ rvm default
~$ ruby --version
ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.0]
~$ ruby test.rb
bar
~$ rvm 1.7.3
~$ ruby --version
jruby 1.7.3 (1.9.3p385) 2013-02-21 dac429b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_37-b06-434-11M3909 [darwin-x86_64]
~$ ruby test.rb
bar
Errno::ENOENT No such file or directory - /Users/akreiling/this/directory/probably/does/not/exist
org/jruby/RubyDir.java:721:in `exists?'
test.rb:1:in `(root)'
test.rb
Ruby
1 2 3 4 5 6 7
if Dir.exists?("this/directory/probably/does/not/exist")
puts "foo"
else
puts "bar"
end
 
puts "#{$!.class} #{$!.message}\n\t" + $!.backtrace.join("\n\t") if $!

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.