Skip to content

Instantly share code, notes, and snippets.

@akreiling
Last active December 15, 2015 11:29
Show Gist options
  • Save akreiling/5253467 to your computer and use it in GitHub Desktop.
Save akreiling/5253467 to your computer and use it in GitHub Desktop.
~$ 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)'
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 $!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment