Sha256: 1adedd42cdae601cc472a274e44d62aa33a13228f593aadb7c05ad370e575bcf
Contents?: true
Size: 721 Bytes
Versions: 3
Compression:
Stored size: 721 Bytes
Contents
require 'rodimus' require 'mongo' require 'json' class MongoInput attr_reader :client, :db, :collection include Rodimus::Step def initialize @client = Mongo::MongoClient.new('localhost', 27017) @db = client['inventory_events'] @collection = db['model_events'] @incoming = collection.find.limit(4) end def process_row(row) row.to_json end end class TempfileOut include Rodimus::Step def initialize @outgoing = File.new('output.txt', 'w') end def process_row(row) JSON.parse(row).keys.join(',') end end t = Rodimus::Transformation.new s1 = MongoInput.new s2 = TempfileOut.new t.steps << s1 t.steps << s2 t.run puts "Transformation to #{s2.outgoing.path} complete!"
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rodimus-0.1.1 | examples/mongo_input.rb |
rodimus-0.1.0 | examples/mongo_input.rb |
rodimus-0.0.1 | examples/mongo_input.rb |