rrepo 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7cf0bd7ba8b414a9057afeb58e0d9ae66a478a71
4
- data.tar.gz: c2e77135d18e928d7307fc63137060ecb765f4b4
3
+ metadata.gz: 89873ed098ba32208c31ceaae415605d5cd6f4aa
4
+ data.tar.gz: 82feca29e6fdf69dd31babc5d720bd0bf871b19a
5
5
  SHA512:
6
- metadata.gz: 716a5710e9e38b80a421ed573884d0c9f1263ce88f0186a199bba16ec875b7045c89f077e05e74c5c5e8ac9ffd160ba16fa222cb9bab1bffeab92035e5cc4953
7
- data.tar.gz: 5848377b3ca7c1c21b81f0b6a497757c10e2997122e02415aa4a83f47a0da0ce753ab9f2777bd98d07429811d25473c897fd21b2f492eefe14dbb65bc107e522
6
+ metadata.gz: da16c7cfa53a57293d345c77dec8bc8d17b7dcf7d37e6bba1525d763d98661e812b9e8f23eb0e22b541b87fdb58fbeee6f2009128e77c66d58b84bf324f6f510
7
+ data.tar.gz: 5a329c7a8ecf75c61f7f6232b7f55037bd93872c252818c0baab9c842fc7155e3ef4c0bca52ac90608ceb8f4a5a130f23219cad55ff3109dd7d95a3e68cd3f12
@@ -44,16 +44,26 @@ module RRepo
44
44
  class Query
45
45
  def initialize(collection, &block)
46
46
  @collection = collection
47
- @query = {}
47
+ @query = [{}]
48
48
  instance_eval(&block) if block_given?
49
49
  end
50
50
 
51
51
  def where(condition)
52
- @query.merge!(condition)
52
+ @query.last.merge!(condition)
53
+ self
54
+ end
55
+
56
+ def or
57
+ @query << {}
58
+ self
53
59
  end
54
60
 
55
61
  def run
56
- @collection.find(@query)
62
+ if @query.size > 1
63
+ @collection.find(:$or => @query)
64
+ else
65
+ @collection.find(@query.first)
66
+ end
57
67
  end
58
68
 
59
69
  def to_hash
data/lib/rrepo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RRepo
2
- VERSION = '0.2.7'.freeze
2
+ VERSION = '0.2.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrepo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joakim Reinert