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.



92
93
94
95
96
97
98
# File 'lib/lara/models/images.rb', line 92

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.



34
35
36
# File 'lib/lara/models/images.rb', line 34

def adapted_to
  @adapted_to
end

#glossariesObject (readonly)

Returns the value of attribute glossaries.



34
35
36
# File 'lib/lara/models/images.rb', line 34

def glossaries
  @glossaries
end

#paragraphsObject (readonly)

Returns the value of attribute paragraphs.



34
35
36
# File 'lib/lara/models/images.rb', line 34

def paragraphs
  @paragraphs
end

#source_languageObject (readonly)

Returns the value of attribute source_language.



34
35
36
# File 'lib/lara/models/images.rb', line 34

def source_language
  @source_language
end

Class Method Details

.from_hash(hash) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/lara/models/images.rb', line 36

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