Class: DeepL::Resources::TranslationMemorySegment
- Inherits:
-
Object
- Object
- DeepL::Resources::TranslationMemorySegment
- Defined in:
- lib/deepl/resources/translation_memory_segments.rb
Instance Attribute Summary collapse
-
#creation_time ⇒ Object
readonly
Returns the value of attribute creation_time.
-
#last_used_time ⇒ Object
readonly
Returns the value of attribute last_used_time.
-
#source_segment_id ⇒ Object
readonly
Returns the value of attribute source_segment_id.
-
#source_text ⇒ Object
readonly
Returns the value of attribute source_text.
-
#targets ⇒ Object
readonly
Returns the value of attribute targets.
-
#updated_time ⇒ Object
readonly
Returns the value of attribute updated_time.
Instance Method Summary collapse
-
#initialize(segment) ⇒ TranslationMemorySegment
constructor
A new instance of TranslationMemorySegment.
- #to_s ⇒ Object
Constructor Details
#initialize(segment) ⇒ TranslationMemorySegment
Returns a new instance of TranslationMemorySegment.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/deepl/resources/translation_memory_segments.rb', line 30 def initialize(segment) @source_segment_id = segment['source_segment_id'] @source_text = segment['source_text'] @targets = (segment['targets'] || []).map do |target| TranslationMemoryTargetSegment.new(target) end @creation_time = Utils::TimeParser.parse_optional_time(segment['creation_time']) @updated_time = Utils::TimeParser.parse_optional_time(segment['updated_time']) @last_used_time = Utils::TimeParser.parse_optional_time(segment['last_used_time']) end |
Instance Attribute Details
#creation_time ⇒ Object (readonly)
Returns the value of attribute creation_time.
27 28 29 |
# File 'lib/deepl/resources/translation_memory_segments.rb', line 27 def creation_time @creation_time end |
#last_used_time ⇒ Object (readonly)
Returns the value of attribute last_used_time.
27 28 29 |
# File 'lib/deepl/resources/translation_memory_segments.rb', line 27 def last_used_time @last_used_time end |
#source_segment_id ⇒ Object (readonly)
Returns the value of attribute source_segment_id.
27 28 29 |
# File 'lib/deepl/resources/translation_memory_segments.rb', line 27 def source_segment_id @source_segment_id end |
#source_text ⇒ Object (readonly)
Returns the value of attribute source_text.
27 28 29 |
# File 'lib/deepl/resources/translation_memory_segments.rb', line 27 def source_text @source_text end |
#targets ⇒ Object (readonly)
Returns the value of attribute targets.
27 28 29 |
# File 'lib/deepl/resources/translation_memory_segments.rb', line 27 def targets @targets end |
#updated_time ⇒ Object (readonly)
Returns the value of attribute updated_time.
27 28 29 |
# File 'lib/deepl/resources/translation_memory_segments.rb', line 27 def updated_time @updated_time end |
Instance Method Details
#to_s ⇒ Object
41 42 43 |
# File 'lib/deepl/resources/translation_memory_segments.rb', line 41 def to_s "#{source_segment_id} - #{source_text}" end |