Class: MapRedus::WordStream

Inherits:
InputStream show all
Defined in:
lib/mapredus/default_classes.rb

Class Method Summary collapse

Methods inherited from InputStream

perform

Methods inherited from QueueProcess

perform, queue

Class Method Details

.scan(data_object) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/mapredus/default_classes.rb', line 3

def self.scan(data_object)
  #
  # The data_object should be a reference to an object that is
  # stored on your system.  The scanner is used to break up what you
  # need from the object into manageable pieces for the mapper.  In
  # this example, the data object is a reference to a redis string.
  #
  test_string = FileSystem.get(data_object)
  
  test_string.split.each_slice(10).each_with_index do |word_set, i|
    yield(i, word_set.join(" "))
  end
end