Class: Wukong::Decorator
- Defined in:
- lib/wukong/decorator.rb
Instance Method Summary collapse
- #append(e) ⇒ Object
-
#initialize(mapper, reducer = nil, options = {}) ⇒ Decorator
constructor
A new instance of Decorator.
- #run ⇒ Object
Constructor Details
#initialize(mapper, reducer = nil, options = {}) ⇒ Decorator
Returns a new instance of Decorator.
10 11 12 13 |
# File 'lib/wukong/decorator.rb', line 10 def initialize(mapper, reducer=nil, ={}) super(nil) @mapper = mapper.new end |
Instance Method Details
#append(e) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/wukong/decorator.rb', line 15 def append(e) line = String.from_java_bytes(e.getBody) record = @mapper.recordize(line.chomp) @mapper.process(*record) do |output| processed = output.to_flat.join("\t") event = EventImpl.new(processed.to_java_bytes, e.getTimestamp, e.getPriority, e.getNanos, e.getHost, e.getAttrs) super event end end |
#run ⇒ Object
25 |
# File 'lib/wukong/decorator.rb', line 25 def run() self ; end |