searchlight 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +4 -0
- data/lib/searchlight/search.rb +2 -1
- data/lib/searchlight/version.rb +1 -1
- data/spec/searchlight/search_spec.rb +20 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjE1ZDkyNDA3ZDMyY2JjOGUzMzgzNGZkYTkxNzBmOGUxMzQ1MTE4NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGJmMTc5N2YyNTBjM2RkNTAyOGZiYTExOGIwMTE1ODc0YTYwNTkxYw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGRkZDEzZjhkOTJjYTUyZWY3ZDQ4ZGFiNDc2NzE1ZTRhNDNjZjgxNTdiYTdi
|
10
|
+
NDM1ZGRjYjJjMmMwNGM4MjcyNjQ3YjQ3N2IwYzdiZTljZTE5NTM5OTcwNTU0
|
11
|
+
ZDY2YThkYjAyZjEwYzU4ZjM1NGNkNDc4ZDc0Y2JjNjZkZjJjMjU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODM4NGQ4MjI4M2M3NjU3NTA2N2FlYTcwZWIxYmE3ODZmODkzNDdmY2E5ZGI2
|
14
|
+
NTlmMDJkZDgyNzdiNGEyZGFmMWMzOWY4NDg5ZmU5YzBhYWE1NTViYWNmMGIz
|
15
|
+
ZWRhNzMxZDQzNWZjODcwZmZiYzc5MTc0ZmZmMTFlNjU1YTQ4N2I=
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
Searchlight does its best to use [semantic versioning](http://semver.org).
|
4
4
|
|
5
|
+
## v1.2.2
|
6
|
+
|
7
|
+
Gracefully handle being given explicit `nil` in initialization instead of options hash or empty arguments
|
8
|
+
|
5
9
|
## v1.2.1
|
6
10
|
|
7
11
|
Bugfix for v1.2.0 - screen out from options any collections containing only blank values
|
data/lib/searchlight/search.rb
CHANGED
@@ -45,7 +45,8 @@ module Searchlight
|
|
45
45
|
@search_target = value
|
46
46
|
end
|
47
47
|
|
48
|
-
def filter_and_mass_assign(provided_options)
|
48
|
+
def filter_and_mass_assign(provided_options = {})
|
49
|
+
provided_options = {} if provided_options.nil?
|
49
50
|
self.options = provided_options.reject { |key, value| is_blank?(value) }
|
50
51
|
begin
|
51
52
|
options.each { |key, value| public_send("#{key}=", value) } if options && options.any?
|
data/lib/searchlight/version.rb
CHANGED
@@ -45,6 +45,26 @@ describe Searchlight::Search do
|
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
|
+
context "when an empty options hash is given" do
|
49
|
+
|
50
|
+
let(:provided_options) { {} }
|
51
|
+
|
52
|
+
it "has empty options" do
|
53
|
+
expect(search.options).to eq({})
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
context "when the options are explicitly nil" do
|
59
|
+
|
60
|
+
let(:provided_options) { nil }
|
61
|
+
|
62
|
+
it "has empty options" do
|
63
|
+
expect(search.options).to eq({})
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
48
68
|
end
|
49
69
|
|
50
70
|
describe "handling invalid options" do
|