Sha256: 051361574ac503653c3a8a8cf6a69891a6d74c465ec79d40b68a70848c8bb4dc
Contents?: true
Size: 1.31 KB
Versions: 6
Compression:
Stored size: 1.31 KB
Contents
# tresse A poorly thought out and stupid source+map+reduce contraption. You source one or more pieces of data, map them a couple of times then reduce them. By default, the whole of Tresse uses 8 work threads, it can be changed: ```ruby Tresse.max_work_thread_count # => 8 Tresse.max_work_thread_count = 10 Tresse.max_work_thread_count # => 10 ``` ## use Two sources flattened together ```ruby r = Tresse::Group.new('test0') .source { (0..3).to_a } .source { (4..9).to_a } .values # or .flatten .sort r #=> (0..9).to_a ``` Combining two sources again ```ruby r = Tresse::Group.new('test0') .source { (0..3).to_a } .source { ('a'..'c').to_a } .map { |e| e.collect { |e| e * 2 } } .values # or .flatten r # => [ 0, 2, 4, 6, 'aa', 'bb', 'cc' ] # or # => [ 'aa', 'bb', 'cc', 0, 2, 4, 6 ] ``` Each can be used, the outcome of its block is discarded ```ruby t = [] # collecting on the side r = Tresse::Group.new('test0') .source { (0..3).to_a } .source { ('a'..'c').to_a } .each { |e| t << e.collect { |e| e * 2 } } .values r # => [ 0, 1, 2, 3, 'a', 'b', 'c' ] # or # => [ 'a', 'b', 'c', 0, 1, 2, 3 ] t # => [ [ 0, 2, 4, 6 ], [ 'aa', 'bb', 'cc' ] ] # or # => [ [ 'aa', 'bb', 'cc' ], [ 0, 2, 4, 6 ] ] ``` ## license MIT, see [LICENSE.txt](LICENSE.txt)
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
tresse-1.2.0 | README.md |
tresse-1.1.3 | README.md |
tresse-1.1.2 | README.md |
tresse-1.1.1 | README.md |
tresse-1.1.0 | README.md |
tresse-1.0.0 | README.md |