Class: BSONInput
- Inherits:
-
Object
- Object
- BSONInput
- Includes:
- Enumerable
- Defined in:
- lib/mongo-hadoop/input.rb
Direct Known Subclasses
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(stream = nil) ⇒ BSONInput
constructor
A new instance of BSONInput.
- #read ⇒ Object
Constructor Details
#initialize(stream = nil) ⇒ BSONInput
Returns a new instance of BSONInput.
4 5 6 |
# File 'lib/mongo-hadoop/input.rb', line 4 def initialize(stream=nil) @stream = stream || $stdin end |
Instance Method Details
#each ⇒ Object
16 17 18 19 20 |
# File 'lib/mongo-hadoop/input.rb', line 16 def each while(doc = read) yield doc end end |
#read ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/mongo-hadoop/input.rb', line 8 def read begin BSON.read_bson_document(@stream) rescue NoMethodError nil end end |