origin 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,11 +6,18 @@
6
6
 
7
7
  ### Resolved Issues
8
8
 
9
+ ## 1.0.3
10
+
11
+ ### Resolved Issues
12
+
13
+ * mongoid/mongoid\#2170 Multi selection ($and/$or) now properly concats
14
+ when merging two criteria.
15
+
9
16
  ## 1.0.2
10
17
 
11
18
  ### Resolved Issues
12
19
 
13
- * mongoid/mongoid \#2165 Multi selection ($and/$or) now takes into account
20
+ * mongoid/mongoid\#2165 Multi selection ($and/$or) now takes into account
14
21
  field aliases.
15
22
 
16
23
  ## 1.0.1
@@ -5,11 +5,24 @@ module Origin
5
5
  # coming into it as well as being alias and locale aware for key names.
6
6
  class Selector < Smash
7
7
 
8
+ # Merges another selector into this one.
9
+ #
10
+ # @example Merge in another selector.
11
+ # selector.merge!(name: "test")
12
+ #
13
+ # @param [ Hash, Selector ] other The object to merge in.
14
+ #
15
+ # @return [ Selector ] The selector.
16
+ #
17
+ # @since 1.0.0
8
18
  def merge!(other)
9
19
  other.each_pair do |key, value|
10
20
  if value.is_a?(Hash) && self[key.to_s].is_a?(Hash)
11
21
  value = self[key.to_s].merge(value)
12
22
  end
23
+ if multi_selection?(key)
24
+ value = (self[key.to_s] || []).concat(value)
25
+ end
13
26
  store(key, value)
14
27
  end
15
28
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Origin
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -145,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  segments:
147
147
  - 0
148
- hash: 3124346352379562039
148
+ hash: -80852933804557315
149
149
  required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements: