Class: OfflineSort::Chunk::InputOutput::Yaml

Inherits:
Base
  • Object
show all
Defined in:
lib/offline_sort/chunk/input_output/yaml.rb

Constant Summary

Constants inherited from Base

Base::MethodNotImplementedError

Instance Attribute Summary

Attributes inherited from Base

#io

Instance Method Summary collapse

Methods inherited from Base

#close, #each, #flush, #initialize, #rewind, #write_entries

Constructor Details

This class inherits a constructor from OfflineSort::Chunk::InputOutput::Base

Instance Method Details

#read_entryObject

The yaml parser does not expose a document enumerator that we can call next on without loading the entire file



8
9
10
# File 'lib/offline_sort/chunk/input_output/yaml.rb', line 8

def read_entry
  YAML.load(next_document)
end

#write_entry(entry) ⇒ Object



12
13
14
# File 'lib/offline_sort/chunk/input_output/yaml.rb', line 12

def write_entry(entry)
  io.write(YAML.dump(entry))
end