Sha256: 53e56d3436f51bac2283dae54bcc43bf6901ff501ae0542f8034955840ee6cfd
Contents?: true
Size: 741 Bytes
Versions: 1
Compression:
Stored size: 741 Bytes
Contents
# frozen_string_literal: true module FunTranslations # This class represents a response returned by FunTranslation API class Translation attr_reader :translated_text, :original_text, :translation, :audio, :speed, :tone # Initializes a new Translation object def initialize(raw_translation) translated = raw_translation['translated'] if translated.respond_to?(:key?) && translated.key?('audio') @audio = translated['audio'] else @translated_text = translated end @original_text = raw_translation['text'] @translation = raw_translation['translation'] @speed = raw_translation['speed'] @tone = raw_translation['tone'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fun_translations-0.0.1 | lib/fun_translations/translation.rb |