Class: Tempfile

Inherits:
Object
  • Object
show all
Defined in:
lib/stickyflag/patches/tempfile_encoding.rb

Class Method Summary collapse

Class Method Details

.new_with_encoding(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/stickyflag/patches/tempfile_encoding.rb', line 7

def self.new_with_encoding(params)
  # JRuby's Tempfile constructor got the third hash parameter in JRuby
  # 1.7.0-preview1.
  if RUBY_VERSION >= "1.9.0" && (RUBY_PLATFORM != 'java' || JRUBY_VERSION >= '1.7.0')
    return Tempfile.new(params, Dir.tmpdir, :encoding => "UTF-8")
  else
    # No coverage on Ruby 1.8, ignore
    #:nocov:
    return Tempfile.new(params)
    #:nocov:
  end
end