Class: BSONOutput
- Inherits:
-
Object
- Object
- BSONOutput
- Defined in:
- lib/mongo-hadoop/output.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(stream = nil) ⇒ BSONOutput
constructor
A new instance of BSONOutput.
- #write(doc) ⇒ Object
Constructor Details
#initialize(stream = nil) ⇒ BSONOutput
Returns a new instance of BSONOutput.
2 3 4 |
# File 'lib/mongo-hadoop/output.rb', line 2 def initialize(stream=nil) @stream = stream || $stdout end |
Instance Method Details
#write(doc) ⇒ Object
6 7 8 9 10 |
# File 'lib/mongo-hadoop/output.rb', line 6 def write(doc) bson_doc = BSON.serialize(doc) @stream.write(bson_doc) @stream.flush end |