Skip to content

Instantly share code, notes, and snippets.

@headius
Forked from joelash/gist:1125362
Created August 4, 2011 15:03
Show Gist options
  • Save headius/1125369 to your computer and use it in GitHub Desktop.
Save headius/1125369 to your computer and use it in GitHub Desktop.
jruby-1.6.3 Digest#file bug when run with JRUBY_OPTS=--1.9
require 'pathname'
require 'digest'
`touch foo.txt`
path = Pathname.new 'foo.txt'
digest = Digest::MD5.new # digest type doesn't matter, see same problem with SHA1
# digest.file path # this line throws an error when have JRUBY_OPTS=--1.9
# workaround 1:
digest.file path.to_s
# workaround 2:
class Digest::Base
alias real_file file
def file(something); real_file(something.to_s); end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment