norr-couchrest 0.30 → 0.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,13 +19,11 @@ module CouchRest
19
19
  key_emit = doc_keys.length == 1 ? "#{doc_keys.first}" : "[#{doc_keys.join(', ')}]"
20
20
  guards = opts.delete(:guards) || []
21
21
  guards.concat doc_keys
22
- map_function = <<-JAVASCRIPT
23
- function(doc) {
24
- if (#{guards.join(' && ')}) {
25
- emit(#{key_emit}, null);
26
- }
22
+ map_function = <<-RUBY
23
+ proc {|doc|
24
+ emit(#{key_emit}, nil) if (#{guards.join(' && ')})
27
25
  }
28
- JAVASCRIPT
26
+ RUBY
29
27
  self['views'][method_name] = {
30
28
  'map' => map_function
31
29
  }
@@ -30,17 +30,11 @@ module CouchRest
30
30
 
31
31
  def default_design_doc
32
32
  {
33
- "language" => "javascript",
33
+ "language" => "ruby",
34
34
  "views" => {
35
35
  'all' => {
36
- 'map' => "function(doc) {
37
- if (doc['couchrest-type'] == '#{self.to_s}') {
38
- emit(null,1);
39
- }
40
- }",
41
- 'reduce' => "function(keys, values) {
42
- return sum(values);
43
- }"
36
+ 'map' => "proc {|doc|emit(nil,1) if doc['couchrest-type'].eql?('#{self.to_s}')}",
37
+ 'reduce' => "proc{|ks,vs,rereduce|sum(vs)}"
44
38
  }
45
39
  }
46
40
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: norr-couchrest
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.30"
4
+ version: 0.30.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - J. Chris Anderson