Sha256: 5c003041f2f69ba15f0cf2022bfba47dd948a32fc7ed3f0ab68b0c63af26670e

Contents?: true

Size: 563 Bytes

Versions: 1

Compression:

Stored size: 563 Bytes

Contents

require_relative "parser"
require_relative "say"

module NATO
  class Text
    attr_reader :original, :natified, :pronunciation

    def initialize(sentence)
      @original = sentence

      natify sentence
    end

    alias_method :to_nato, :natified
    alias_method :to_s, :to_nato

    def say
      NATO::Say.(self)
    end

    private

    def natify(sentence)
      Parser.instance.natify(sentence).tap do |natified|
        @natified = natified.map(&:first).join(" ")
        @pronunciation = natified.map(&:last).join(" ")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
NATO-0.1.0 lib/NATO/text.rb