mongo_aggregation_dsl 0.0.1.alpha → 0.0.2.alpha

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d74e223434810e11aa89d221ac2d04345a15f2e0
4
- data.tar.gz: 7c4e467b678357a932b9812076117236aab828ac
3
+ metadata.gz: bf04296272e988d1f33eb80b9c529c2d0c1debdc
4
+ data.tar.gz: 309b6f158ed999d4f1c87d269102cbb1151bb800
5
5
  SHA512:
6
- metadata.gz: 09a466f9083d4cc7e11c49439e8be47d5de34082fb856cad6fe273f94c0299c23c513d1917e0a2bc0d235012665d02b0b08e65fcccf3b495638c84fe5b217eda
7
- data.tar.gz: 39ba1a5d4c7a43be3be8b2034a00e7282ce2f76cda6c1862eefa234c916b8be836bc7fe207fdd38115a25994a4355bda37e6501ed60e74919c91b66527837961
6
+ metadata.gz: 69bf0d84c9036935cebe0d1d1582c071bc8accd4b686f2f0ec8c44e120f8a89195d734653e9d427226326ecb488dce9ed660690b592108f1cdceebee05c40d5d
7
+ data.tar.gz: c947143db1ac1d8cc94062df4029d03b01801417227463d89bd654134c4740c1c2bcb79da2810d7f0dcd41ae8d881fd13b20b7a9c7f2e654475078ff5a66a17c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongo_aggregation_dsl (0.0.1.alpha)
4
+ mongo_aggregation_dsl (0.0.2.alpha)
5
5
  autoloaded (~> 2)
6
6
  contracts-lite
7
7
  mongo (~> 2.6.2)
@@ -5,11 +5,18 @@ module Aggregate
5
5
  # Represents an aggregation lookup
6
6
  # https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/#pipe._S_lookup
7
7
  class Lookup < HashBase
8
- Contract KeywordArgs[
9
- from: C::ClassIncludes[[Mongoid::Document]],
10
- as: String,
11
- let: And[HashOf[Symbol, Symbol], C::HashMinLength[1]],
12
- pipeline: Aggregate::Pipeline] => Any
8
+ Contract Or[
9
+ KeywordArgs[
10
+ from: C::ClassIncludes[[Mongoid::Document]],
11
+ as: String,
12
+ localField: String,
13
+ foreignField: String],
14
+ KeywordArgs[
15
+ from: C::ClassIncludes[[Mongoid::Document]],
16
+ as: String,
17
+ let: And[HashOf[Symbol, Symbol], C::HashMinLength[1]],
18
+ pipeline: Aggregate::Pipeline]
19
+ ] => Any
13
20
  def initialize(options)
14
21
  super(options)
15
22
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aggregate
4
+ module Values
5
+ # Returns a string wrapped in single quotes if the value or string if a key
6
+ class Boolean < Base
7
+ def to_s
8
+ inspect
9
+ end
10
+
11
+ def inspect
12
+ value.to_s
13
+ end
14
+
15
+ class << self
16
+ def handles?(value)
17
+ value.is_a? ::Boolean
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -9,7 +9,7 @@ module Aggregate
9
9
  end
10
10
 
11
11
  def inspect
12
- is_key ? value.to_s : "'#{value}'"
12
+ "'#{value}'"
13
13
  end
14
14
 
15
15
  class << self
@@ -39,7 +39,7 @@ module Aggregate
39
39
 
40
40
  retval = :_id if value == :id
41
41
 
42
- is_key ? retval.to_s : "'#{retval}'"
42
+ "'#{retval}'"
43
43
  end
44
44
 
45
45
  class << self
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "mongo_aggregation_dsl"
5
- spec.version = "0.0.1.alpha"
5
+ spec.version = "0.0.2.alpha"
6
6
  spec.authors = ["KrimsonKla"]
7
7
  spec.email = ["admin@cardtapp.com"]
8
8
  spec.date = "2018-09-10"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_aggregation_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha
4
+ version: 0.0.2.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - KrimsonKla
@@ -350,6 +350,7 @@ files:
350
350
  - lib/aggregate/values.rb
351
351
  - lib/aggregate/values/array.rb
352
352
  - lib/aggregate/values/base.rb
353
+ - lib/aggregate/values/boolean.rb
353
354
  - lib/aggregate/values/document_class.rb
354
355
  - lib/aggregate/values/hash.rb
355
356
  - lib/aggregate/values/nil.rb