Sha256: 209daecc6bfe51e9516ff0d1de8c09af295fd3c81e239db8034762673775f8be

Contents?: true

Size: 702 Bytes

Versions: 22

Compression:

Stored size: 702 Bytes

Contents

require 'tempfile'

module Bulldog
  if RUBY_VERSION >= '1.8.7'
    Tempfile = ::Tempfile
  else
    #
    # Backport Ruby 1.8.7's Tempfile feature which allows specifying the
    # extension by passing in the path as a 2-element array.  Useful for
    # things like ImageMagick, which often rely on the file extension.
    #
    class Tempfile < ::Tempfile
      private

      def make_tmpname(basename, n)
        case basename
        when Array
          prefix, suffix = *basename
        else
          prefix, suffix = basename, ''
        end

        t = Time.now.strftime("%Y%m%d")
        path = "#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}-#{n}#{suffix}"
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
bulldog-0.2.4 lib/bulldog/tempfile.rb
bulldog-0.2.3 lib/bulldog/tempfile.rb
bulldog-0.2.2 lib/bulldog/tempfile.rb
bulldog-0.2.1 lib/bulldog/tempfile.rb
bulldog-0.2.0 lib/bulldog/tempfile.rb
bulldog-0.1.1 lib/bulldog/tempfile.rb
bulldog-0.1.0 lib/bulldog/tempfile.rb
bulldog-0.0.15 lib/bulldog/tempfile.rb
bulldog-0.0.14 lib/bulldog/tempfile.rb
bulldog-0.0.13 lib/bulldog/tempfile.rb
bulldog-0.0.12 lib/bulldog/tempfile.rb
bulldog-0.0.11 lib/bulldog/tempfile.rb
bulldog-0.0.10 lib/bulldog/tempfile.rb
bulldog-0.0.9 lib/bulldog/tempfile.rb
bulldog-0.0.8 lib/bulldog/tempfile.rb
bulldog-0.0.7 lib/bulldog/tempfile.rb
bulldog-0.0.6 lib/bulldog/tempfile.rb
bulldog-0.0.5 lib/bulldog/tempfile.rb
bulldog-0.0.3 lib/bulldog/tempfile.rb
bulldog-0.0.4 lib/bulldog/tempfile.rb