Class: Marbu::Models::Db::MongoDb
- Inherits:
-
Object
- Object
- Marbu::Models::Db::MongoDb
- Includes:
- Mongoid::Document
- Defined in:
- lib/marbu/models/db/mongodb/mongodb.rb,
lib/marbu/models/db/mongodb/structure.rb,
lib/marbu/models/db/mongodb/exceptions.rb
Defined Under Namespace
Instance Method Summary collapse
- #default_params ⇒ Object
-
#initialize(ext_params = {}) ⇒ MongoDb
constructor
A new instance of MongoDb.
Constructor Details
#initialize(ext_params = {}) ⇒ MongoDb
Returns a new instance of MongoDb.
17 18 19 20 21 22 23 24 |
# File 'lib/marbu/models/db/mongodb/mongodb.rb', line 17 def initialize( ext_params = {} ) super params = default_params.merge( ext_params.delete_if{|k,v| v.blank? }) self.uuid = params[:uuid] self.name = params[:name] self.map_reduce_finalize = MapReduceFinalize.new( params[:map_reduce_finalize] ) end |
Instance Method Details
#default_params ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/marbu/models/db/mongodb/mongodb.rb', line 26 def default_params { :name => "NoName00", :uuid => UUID.new.generate(:compact), :map_reduce_finalize => { :map => { :keys => [{:name => "map_key1"}], :values => [{:name => "map_value1"}] }, :reduce => { :keys => [{:name => "reduce_key1"}], :values => [{:name => "reduce_value1"}] }, :finalize => { :keys => [{:name => "finalize_key1"}], :values => [{:name => "finalize"}] }, :misc => { :database => 'database', :input_collection => 'input_collection', :output_collection => 'output_collection' } } } end |