Class: GoogleTranslateDiff::Chunker
- Inherits:
-
Object
- Object
- GoogleTranslateDiff::Chunker
- Extended by:
- Dry::Initializer
- Defined in:
- lib/google_translate_diff/chunker.rb
Defined Under Namespace
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
12 13 14 |
# File 'lib/google_translate_diff/chunker.rb', line 12 def call chunks.map(&:values) end |
#chunks ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/google_translate_diff/chunker.rb', line 16 def chunks values.each_with_object([]) do |value, chunks| validate_value_size(value) tail = chunks.last if next_chunk?(tail, value) chunks << Chunk.new([], 0) tail = chunks.last end update_chunk(tail, value) end end |