Sha256: 6b5778006cf07e1ccaeb3bfb2ba36e6ffc0f52a4a1d5970bd8e472a2aea691f1

Contents?: true

Size: 478 Bytes

Versions: 1

Compression:

Stored size: 478 Bytes

Contents

require 'tempfile'

module Dragonfly
  module Utils

    module_function

    def new_tempfile(ext=nil, content=nil)
      tempfile = ext ? Tempfile.new(['dragonfly', ".#{ext}"]) : Tempfile.new('dragonfly')
      tempfile.binmode
      tempfile.write(content) if content
      tempfile.close
      tempfile
    end

    def symbolize_keys(hash)
      hash.inject({}) do |new_hash, (key, value)|
        new_hash[key.to_sym] = value
        new_hash
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dragonfly-0.9.13 lib/dragonfly/utils.rb