tts_template.rb
1# frozen_string_literal: true
2
3class TTSTemplate
4 def initialize(view)
5 @view = view
6 end
7
8 def template_path
9 "#{File.dirname(__dir__)}/views/#{@view}.slim"
10 end
11
12 def tts(scope)
13 Nokogiri::XML.parse(
14 Slim::Template.new(template_path).render(scope)
15 ).find("//SpeakSentence").map(&:content).join(" ")
16 end
17end