Sha256: f30a469b8985f54119867d1f114484e72660ab4e808450d8ded82f3b5b1c58d7
Contents?: true
Size: 900 Bytes
Versions: 2
Compression:
Stored size: 900 Bytes
Contents
require 'ssmd/processors' module SSMD class Converter attr_reader :input def initialize(input) @input = input end def convert result = processors.inject(input.encode(xml: :text)) do |text, processor| process processor.new, text end "<speak>#{result.strip}</speak>" end def strip processors.inject(input) do |text, processor| process processor.new, text, strip: true end end def processors p = SSMD::Processors [ p::EmphasisProcessor, p::AnnotationProcessor, p::MarkProcessor, p::ProsodyProcessor ] end def process(processor, input, strip: false) if processor.matches? input result = strip ? processor.strip_ssmd(input) : processor.substitute(input) process processor, result, strip: strip else input end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ssmd-0.3.1 | lib/ssmd/converter.rb |
ssmd-0.3.0 | lib/ssmd/converter.rb |