Sha256: aecac0aa358c5eda4d0d07963ae7317d65111d04c39128004a002f00d538aa93

Contents?: true

Size: 488 Bytes

Versions: 4

Compression:

Stored size: 488 Bytes

Contents

module Ting
  class Writer
    include Procable

    def initialize(conv, tone)
      @conv = conv.to_s
      @tone = Tones.const_get Ting.camelize(tone.to_s)
    end

    def generate(syll)
      Array(syll).map do |s|
        syllable = Conversions.unparse(@conv, s)
        str = @tone.add_tone(syllable, s.tone)
        str.capitalize! if s.capitalized?
        str
      end.join(' ')
    end

    alias :<< :generate
    alias :unparse :generate
    alias :call :generate
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ting-0.12.0 lib/ting/writer.rb
ting-0.11.0 lib/ting/writer.rb
ting-0.10.0 lib/ting/writer.rb
ting-0.9.0 lib/ting/writer.rb