Class: Lara::Models::ImageTextResult

Inherits:
Base
  • Object
show all
Defined in:
lib/lara/models/images.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

parse_time

Constructor Details

#initialize(source_language:, paragraphs:, adapted_to: nil, glossaries: nil) ⇒ ImageTextResult

Returns a new instance of ImageTextResult.



79
80
81
82
83
84
85
# File 'lib/lara/models/images.rb', line 79

def initialize(source_language:, paragraphs:, adapted_to: nil, glossaries: nil)
  super()
  @source_language = source_language
  @adapted_to = adapted_to
  @glossaries = glossaries
  @paragraphs = paragraphs
end

Instance Attribute Details

#adapted_toObject (readonly)

Returns the value of attribute adapted_to.



21
22
23
# File 'lib/lara/models/images.rb', line 21

def adapted_to
  @adapted_to
end

#glossariesObject (readonly)

Returns the value of attribute glossaries.



21
22
23
# File 'lib/lara/models/images.rb', line 21

def glossaries
  @glossaries
end

#paragraphsObject (readonly)

Returns the value of attribute paragraphs.



21
22
23
# File 'lib/lara/models/images.rb', line 21

def paragraphs
  @paragraphs
end

#source_languageObject (readonly)

Returns the value of attribute source_language.



21
22
23
# File 'lib/lara/models/images.rb', line 21

def source_language
  @source_language
end

Class Method Details

.from_hash(hash) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/lara/models/images.rb', line 23

def self.from_hash(hash)
  return nil unless hash.is_a?(Hash)

  paragraphs = (hash["paragraphs"] || []).map { |p| build_paragraph(p) }

  new(
    source_language: hash["sourceLanguage"],
    adapted_to: hash["adaptedTo"],
    glossaries: hash["glossaries"],
    paragraphs: paragraphs
  )
end