Class: OfflineSort::Sorter
- Inherits:
-
Object
- Object
- OfflineSort::Sorter
- Defined in:
- lib/offline_sort/offline_sort.rb
Defined Under Namespace
Classes: ChunkEntry
Constant Summary collapse
- DEFAULT_CHUNK_IO_CLASS =
defined?(::MessagePack) ? Chunk::InputOutput::MessagePack : Chunk::InputOutput::Marshal
- DEFAULT_CHUNK_SIZE =
1000
Instance Attribute Summary collapse
-
#chunk_input_output_class ⇒ Object
readonly
Returns the value of attribute chunk_input_output_class.
-
#chunk_size ⇒ Object
readonly
Returns the value of attribute chunk_size.
-
#enumerable ⇒ Object
readonly
Returns the value of attribute enumerable.
-
#sort_by ⇒ Object
readonly
Returns the value of attribute sort_by.
Instance Method Summary collapse
-
#initialize(enumerable, chunk_input_output_class: DEFAULT_CHUNK_IO_CLASS, chunk_size: DEFAULT_CHUNK_SIZE, &sort_by) ⇒ Sorter
constructor
A new instance of Sorter.
- #sort ⇒ Object
Constructor Details
#initialize(enumerable, chunk_input_output_class: DEFAULT_CHUNK_IO_CLASS, chunk_size: DEFAULT_CHUNK_SIZE, &sort_by) ⇒ Sorter
Returns a new instance of Sorter.
15 16 17 18 19 20 |
# File 'lib/offline_sort/offline_sort.rb', line 15 def initialize(enumerable, chunk_input_output_class: DEFAULT_CHUNK_IO_CLASS, chunk_size: DEFAULT_CHUNK_SIZE, &sort_by) @enumerable = enumerable @chunk_input_output_class = chunk_input_output_class @chunk_size = chunk_size @sort_by = sort_by end |
Instance Attribute Details
#chunk_input_output_class ⇒ Object (readonly)
Returns the value of attribute chunk_input_output_class.
13 14 15 |
# File 'lib/offline_sort/offline_sort.rb', line 13 def chunk_input_output_class @chunk_input_output_class end |
#chunk_size ⇒ Object (readonly)
Returns the value of attribute chunk_size.
13 14 15 |
# File 'lib/offline_sort/offline_sort.rb', line 13 def chunk_size @chunk_size end |
#enumerable ⇒ Object (readonly)
Returns the value of attribute enumerable.
13 14 15 |
# File 'lib/offline_sort/offline_sort.rb', line 13 def enumerable @enumerable end |
#sort_by ⇒ Object (readonly)
Returns the value of attribute sort_by.
13 14 15 |
# File 'lib/offline_sort/offline_sort.rb', line 13 def sort_by @sort_by end |
Instance Method Details
#sort ⇒ Object
22 23 24 |
# File 'lib/offline_sort/offline_sort.rb', line 22 def sort merge(split) end |