Sha256: 948759d6f91e0fbe87f63a9ce524283bb931a9c67bb2b9322fbaab70d8539f9e
Contents?: true
Size: 548 Bytes
Versions: 1
Compression:
Stored size: 548 Bytes
Contents
# frozen_string_literal: true require "tempfile" require "securerandom" module GoogleTranslateTts module Fileable def self.included(base) base.extend(ClassMethods) end module ClassMethods def with_temp_file(name = "tts-#{SecureRandom.uuid}", &block) setup_temp_dir! Tempfile.create(name, self::TTS_TMP_DIR) do |file| block.call(file) end end def setup_temp_dir! FileUtils.mkdir_p(self::TTS_TMP_DIR) unless Dir.exist? self::TTS_TMP_DIR end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
google-translate-tts-0.2.0 | lib/google_translate_tts/fileable.rb |