Class: RubyReduce::OutputWriter
- Inherits:
-
Object
- Object
- RubyReduce::OutputWriter
- Defined in:
- lib/ruby_reduce/out_put.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ OutputWriter
constructor
A new instance of OutputWriter.
- #write(data) ⇒ Object
Constructor Details
#initialize(options) ⇒ OutputWriter
Returns a new instance of OutputWriter.
3 4 5 6 7 |
# File 'lib/ruby_reduce/out_put.rb', line 3 def initialize() @collection_name = @mongo_db = Mongo::Connection.new(RubyReduce.mongo_connection).db(RubyReduce.mongo_db) end |
Instance Method Details
#write(data) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/ruby_reduce/out_put.rb', line 9 def write(data) @mongo_db[@collection_name].remove() data.each do |key, values| @mongo_db[@collection_name].insert({:_id => key, :value => values}) end end |