Skip to content

Instantly share code, notes, and snippets.

@kml
Created December 13, 2016 22:59
Show Gist options
  • Save kml/47ae09c02bb66360f8c88dbf4ae2a0e2 to your computer and use it in GitHub Desktop.
Save kml/47ae09c02bb66360f8c88dbf4ae2a0e2 to your computer and use it in GitHub Desktop.
# encoding: utf-8
# In JRuby, Tempfile is implemented in Java. We were able to improve the performance substantially,
# and avoid the buggy stdlib version in the process.
# -- Nick Sieger
# http://stackoverflow.com/questions/1466460/jruby-tempfile-rb
# JRuby: Tempfile.new('p').path => "/tmp/p.4642.20811"
# 1.9.3: Tempfile.new('p').path => "/tmp/p20120426-4327-19gcrqi"
# Ujednolicenie generowanej nazwy pliku tymczasowego:
require 'tempfile'
require 'tmpdir'
class Tempfile
def make_tmpname(prefix_suffix, n)
Dir::Tmpname.make_tmpname(prefix_suffix, n)
end
end if defined?(JRUBY_VERSION)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment