Class: GOM::Storage::CouchDB::View::BuilderFromClass
- Inherits:
-
Object
- Object
- GOM::Storage::CouchDB::View::BuilderFromClass
- Defined in:
- lib/gom/storage/couchdb/view/builder_from_class.rb
Overview
Builds a javascript map-reduce-view out of a class view.
Instance Method Summary collapse
-
#initialize(class_view) ⇒ BuilderFromClass
constructor
A new instance of BuilderFromClass.
- #map_reduce_view ⇒ Object
Constructor Details
#initialize(class_view) ⇒ BuilderFromClass
Returns a new instance of BuilderFromClass.
5 6 7 |
# File 'lib/gom/storage/couchdb/view/builder_from_class.rb', line 5 def initialize(class_view) @class_view = class_view end |
Instance Method Details
#map_reduce_view ⇒ Object
9 10 11 12 13 14 |
# File 'lib/gom/storage/couchdb/view/builder_from_class.rb', line 9 def map_reduce_view GOM::Storage::Configuration::View::MapReduce.new( "function(document) {\n if (document['model_class'] == '#{@class_view.class_name}') {\n emit(document['_id'], null);\n }\n}", nil ) end |