Class: Lara::Models::TextResult
Instance Attribute Summary collapse
-
#adapted_to ⇒ Object
readonly
Returns the value of attribute adapted_to.
-
#adapted_to_matches ⇒ Object
readonly
Returns the value of attribute adapted_to_matches.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#glossaries ⇒ Object
readonly
Returns the value of attribute glossaries.
-
#glossaries_matches ⇒ Object
readonly
Returns the value of attribute glossaries_matches.
-
#profanities ⇒ Object
readonly
Returns the value of attribute profanities.
-
#source_language ⇒ Object
readonly
Returns the value of attribute source_language.
-
#styleguide_results ⇒ Object
readonly
Returns the value of attribute styleguide_results.
-
#translation ⇒ Object
readonly
Returns the value of attribute translation.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(content_type:, source_language:, translation:, adapted_to: nil, glossaries: nil, adapted_to_matches: nil, glossaries_matches: nil, profanities: nil, styleguide_results: nil) ⇒ TextResult
constructor
A new instance of TextResult.
Methods inherited from Base
Constructor Details
#initialize(content_type:, source_language:, translation:, adapted_to: nil, glossaries: nil, adapted_to_matches: nil, glossaries_matches: nil, profanities: nil, styleguide_results: nil) ⇒ TextResult
Returns a new instance of TextResult.
184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/lara/models/text.rb', line 184 def initialize(content_type:, source_language:, translation:, adapted_to: nil, glossaries: nil, adapted_to_matches: nil, glossaries_matches: nil, profanities: nil, styleguide_results: nil) super() @content_type = content_type @source_language = source_language @translation = translation @adapted_to = adapted_to @glossaries = glossaries @adapted_to_matches = adapted_to_matches @glossaries_matches = glossaries_matches @profanities = profanities @styleguide_results = styleguide_results end |
Instance Attribute Details
#adapted_to ⇒ Object (readonly)
Returns the value of attribute adapted_to.
150 151 152 |
# File 'lib/lara/models/text.rb', line 150 def adapted_to @adapted_to end |
#adapted_to_matches ⇒ Object (readonly)
Returns the value of attribute adapted_to_matches.
150 151 152 |
# File 'lib/lara/models/text.rb', line 150 def adapted_to_matches @adapted_to_matches end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
150 151 152 |
# File 'lib/lara/models/text.rb', line 150 def content_type @content_type end |
#glossaries ⇒ Object (readonly)
Returns the value of attribute glossaries.
150 151 152 |
# File 'lib/lara/models/text.rb', line 150 def glossaries @glossaries end |
#glossaries_matches ⇒ Object (readonly)
Returns the value of attribute glossaries_matches.
150 151 152 |
# File 'lib/lara/models/text.rb', line 150 def glossaries_matches @glossaries_matches end |
#profanities ⇒ Object (readonly)
Returns the value of attribute profanities.
150 151 152 |
# File 'lib/lara/models/text.rb', line 150 def profanities @profanities end |
#source_language ⇒ Object (readonly)
Returns the value of attribute source_language.
150 151 152 |
# File 'lib/lara/models/text.rb', line 150 def source_language @source_language end |
#styleguide_results ⇒ Object (readonly)
Returns the value of attribute styleguide_results.
150 151 152 |
# File 'lib/lara/models/text.rb', line 150 def styleguide_results @styleguide_results end |
#translation ⇒ Object (readonly)
Returns the value of attribute translation.
150 151 152 |
# File 'lib/lara/models/text.rb', line 150 def translation @translation end |
Class Method Details
.from_hash(hash) ⇒ Object
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/lara/models/text.rb', line 155 def self.from_hash(hash) return nil unless hash.is_a?(Hash) translation = hash["translation"] if translation.is_a?(Array) && translation.is_a?(Array) && !translation.all?(String) translation = translation.map do |e| TextBlock.new(text: e["text"], translatable: e["translatable"]) end end adapted_to_matches = convert_matches(hash["adapted_to_matches"], NGMemoryMatch) glossaries_matches = convert_matches(hash["glossaries_matches"], NGGlossaryMatch) profanities = convert_profanities(hash["profanities"]) styleguide_results = convert_styleguide_results(hash["styleguide_results"]) new( content_type: hash["content_type"], source_language: hash["source_language"], translation: translation, adapted_to: hash["adapted_to"], glossaries: hash["glossaries"], adapted_to_matches: adapted_to_matches, glossaries_matches: glossaries_matches, profanities: profanities, styleguide_results: styleguide_results ) end |