Module: GoogleTranslateTts::Fileable::ClassMethods
- Defined in:
- lib/google_translate_tts/fileable.rb
Instance Method Summary collapse
Instance Method Details
#setup_temp_dir! ⇒ Object
21 22 23 |
# File 'lib/google_translate_tts/fileable.rb', line 21 def setup_temp_dir! FileUtils.mkdir_p(self::TTS_TMP_DIR) unless Dir.exist? self::TTS_TMP_DIR end |
#with_temp_file(name = "tts-#{SecureRandom.uuid}", &block) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/google_translate_tts/fileable.rb', line 13 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 |