Module: TranslatorText::Types

Defined in:
lib/translator_text/types.rb,
lib/translator_text/types/sentence.rb,
lib/translator_text/types/alternative.rb,
lib/translator_text/types/translation.rb,
lib/translator_text/types/detection_result.rb,
lib/translator_text/types/translation_result.rb

Overview

Includes all the types for the exchanges with the API

Defined Under Namespace

Modules: JSON Classes: Alternative, DetectionResult, Sentence, Translation, TranslationResult

Constant Summary collapse

Symbol =
Types::Symbol.constructor do |str|
  str ? str.to_sym : str
end

Class Method Summary collapse

Class Method Details

.Sentence(item) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/translator_text/types.rb', line 15

def Sentence(item)
  if item.is_a?(Types::Sentence)
    item
  elsif item.is_a?(String)
    Types::Sentence.new(Text: item)
  end
end