learn_mapreduce 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/learn_mapreduce.rb +30 -5
  2. metadata +1 -1
@@ -5,20 +5,45 @@ class MapReduce
5
5
  @reducer = nil
6
6
  end
7
7
 
8
- # Call this function with a block to set the mapper function
9
- # The mapper takes a record as argument
8
+ # Set the mapper function
9
+ #
10
+ # Example:
11
+ # mr = MapReduce.new
12
+ # mr.map do |record|
13
+ # ...
14
+ # end
15
+ #
16
+ # Arguments:
17
+ # mapper: (block)
10
18
  def map &mapper
11
19
  @mapper = mapper
12
20
  end
13
21
 
14
- # Call this function with a block to set the reducer function
15
- # The reducer takes a key and a list of values as arguments
22
+ # Set the reducer function
23
+ #
24
+ # Example:
25
+ # mr = MapReduce.new
26
+ # mr.reduce do |key, list_of_values|
27
+ # ...
28
+ # end
29
+ #
30
+ # Arguments:
31
+ # reducer: (block)
16
32
  def reduce &reducer
17
33
  @reducer = reducer
18
34
  end
19
35
 
20
36
  # Run a MapReduce algorithm on the data provided
21
- # Returns a hash containing the emitted tuples, the shuffled tuples and the output
37
+ #
38
+ # Example:
39
+ # mr = MapReduce.new
40
+ # mr.run(data)
41
+ #
42
+ # Arguments:
43
+ # data: (array)
44
+ #
45
+ # Returns:
46
+ # [emitted, shuffled, output]
22
47
  def run data
23
48
  throw "Mapper missing!" unless @mapper
24
49
  throw "Reducer missing!" unless @reducer
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: learn_mapreduce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: