Class: GOM::Storage::CouchDB::View::BuilderFromProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/gom/storage/couchdb/view/builder_from_property.rb

Overview

Builds a javascript map-reduce-view out of a property view.

Instance Method Summary collapse

Constructor Details

#initialize(property_view) ⇒ BuilderFromProperty

Returns a new instance of BuilderFromProperty.



5
6
7
# File 'lib/gom/storage/couchdb/view/builder_from_property.rb', line 5

def initialize(property_view)
  @property_view = property_view
end

Instance Method Details

#map_reduce_viewObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/gom/storage/couchdb/view/builder_from_property.rb', line 9

def map_reduce_view
  build_conditions
  build_emits
  build_emit_string

  GOM::Storage::Configuration::View::MapReduce.new(
    "function(document) {\n  if (#{@conditions.join(" && ")}) {\n    emit(#{@emit_string}, null);\n  }\n}",
    nil
  )
end