Class: StringUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/string_util.rb

Overview

String-related helper functions

Class Method Summary collapse

Class Method Details

.tts_file_name(text, target, service) ⇒ Object



6
7
8
9
# File 'lib/string_util.rb', line 6

def self.tts_file_name(text, target, service)
  hash = StringUtil.tts_hash(text, target, service)
  "#{Application.app_dir}/pronunciations/#{hash}.mp3"
end

.tts_hash(text, target, service) ⇒ Object



11
12
13
# File 'lib/string_util.rb', line 11

def self.tts_hash(text, target, service)
  Digest::SHA1.hexdigest("#{text}_#{target}_#{service}")
end