seek_party 0.0.7 → 0.0.8

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
  SHA256:
3
- metadata.gz: b9ca4febe67fa2d49be42382e873cb43603637ea35b5805ded2094e7ca00a81b
4
- data.tar.gz: 97230f779030919364246a8b29c6025ab4cada187ff178cc082f21abcbacae28
3
+ metadata.gz: 3ca3c040d22ecaf44d42c4d94f63bc34795a691ebc3fcf24a201ba346611c560
4
+ data.tar.gz: 884466fbeb0b97fc741e82e21eca594d1611c78407eabb7f44f2606a3f5e8812
5
5
  SHA512:
6
- metadata.gz: 1beafb8d9d58158923892605504c2651a208a4ab66fd056cb1976524e9fa3ae0d182f99dc093aac61257ff6267769738fad39a6ad7f499e77abb61e832f06d3c
7
- data.tar.gz: 0ac839a39a242cc1904ea7637304ce14aa8d5b57ea85cbfed1e63b9ebd4fdbec0a71c7df6c84df8f01bd7f3fe45bac19b30311631bb9715f022397e5eaa2b879
6
+ metadata.gz: 65fba3d3ab15003a1a3c781f8101a405f308688c6fcf3cd0ef1349551c13a795146c67d5e5ccd054af6f1fc26f45321d9574dc5ef0eb22bac38481d61daad8f7
7
+ data.tar.gz: 2de6b896f03f992aafa9b6cdaf80165289eeaab1eaae0a79c7b736cd436accee7bd1fdcf31018476270c8348e29e92d51f476a3528f948c60fd1920d648e748a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seek_party (0.0.7)
4
+ seek_party (0.0.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -136,7 +136,7 @@ User.search(params: params)
136
136
  And this would result in the following query being produced:
137
137
 
138
138
  ``` sql
139
- SELECT "users".* FROM "users" WHERE (LOWER(CAST(users.name AS TEXT)) LIKE '%sugoi%' AND LOWER(CAST(users.name AS TEXT)) = 'bilbo' OR LOWER(CAST(users.email AS TEXT)) LIKE '%sugoi%' AND LOWER(CAST(users.name AS TEXT)) = 'bilbo')
139
+ SELECT "users".* FROM "users" WHERE (LOWER(CAST(users.name AS TEXT)) LIKE '%bilbo@theshire.com%' AND LOWER(CAST(users.name AS TEXT)) = 'bilbo' OR LOWER(CAST(users.email AS TEXT)) LIKE '%bilbo@theshire.com%' AND LOWER(CAST(users.name AS TEXT)) = 'bilbo')
140
140
  ```
141
141
 
142
142
  ### TO DO
@@ -39,8 +39,22 @@ module SeekParty
39
39
  # else, as the returned object from run_search is an
40
40
  # ActiveRecord_Relation object that would accept
41
41
  # method chaining
42
- @scopes.each do |key, value|
43
- @inspected_class = @inspected_class.method(key).call(value)
42
+ @scopes.each do |scope|
43
+ if scope.respond_to?(:keys)
44
+ scope.keys.each do |key|
45
+ scope_call(key, scope[key])
46
+ end
47
+ else
48
+ scope_call(scope, nil)
49
+ end
50
+ end
51
+ end
52
+
53
+ def scope_call(key, value)
54
+ if value.present?
55
+ @inspected_class = @inspected_class.method(key).call(*value)
56
+ else
57
+ @inspected_class = @inspected_class.method(key).call
44
58
  end
45
59
  end
46
60
  end
@@ -1,3 +1,3 @@
1
1
  module SeekParty
2
- VERSION = '0.0.7'.freeze
2
+ VERSION = '0.0.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seek_party
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Washington
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-25 00:00:00.000000000 Z
11
+ date: 2020-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler