pattern_query_helper 0.1.6 → 0.1.7

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: 55ed2ba55f42fcddaedda67af2615b14b97fd35e
4
- data.tar.gz: 4c523ba2e50d29f74618ff819b78224d24006f9e
3
+ metadata.gz: 5933735e1e09a3803b1a896b909bcfac03df72ef
4
+ data.tar.gz: 6a7b84868229e6faba1a39e3751fb3f562cc8098
5
5
  SHA512:
6
- metadata.gz: a3557ac52ea137c52776f03966153cbaa1fa46feccadbe0d4cd3c8b4a0c8c8a2e4d9a0c701864289b24bccc0101ba132ccf65c2b1771a078913989baf88f27d5
7
- data.tar.gz: b3cc2a06421888079f0ccc2a3681db9b3320644b4046545aa31ec8f54df7384e696c8cffd8a1fef91ee4b0fa937ba396162cea283f182656c03f199dd4c207c1
6
+ metadata.gz: f92ea4b1daa987c102a23aff0125941a37255e57ba2c773588466c9ed68c520176bcdb1642dbb25c1ee1506b870e66da8159eef455d576f4985f5a0839cdba1a
7
+ data.tar.gz: d9ee2ebcd3e3008fe1212ba3838835a4158468ef6e534821cd60d951c7ba8b348873d2a87f5b7c01811fecf3e80aefcce4a27a079f9b41c8cc2fc40bc4eaf59f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pattern_query_helper (0.1.6)
4
+ pattern_query_helper (0.1.7)
5
5
  activerecord (~> 5.0)
6
6
  kaminari
7
7
 
@@ -6,28 +6,23 @@ require "pattern_query_helper/sorting"
6
6
  require "pattern_query_helper/sql"
7
7
 
8
8
  module PatternQueryHelper
9
- PAGINATED_QUERY = "paginated"
10
- SINGLE_RECORD_QUERY = "single_record"
11
- COMPLETE_QUERY = "all"
12
9
 
13
- def self.run_sql_query(model, query, query_params, query_helpers, query_type)
14
- case query_type
15
- when "single_record"
10
+ def self.run_sql_query(model, query, query_params, query_helpers, single_record=false)
11
+ if single_record
16
12
  single_record_sql_query(model, query, query_params, query_helpers)
17
- when "paginated"
13
+ elsif query_helpers[:per_page] || query_helpers[:page]
18
14
  paginated_sql_query(model, query, query_params, query_helpers)
19
- when "all"
15
+ else
20
16
  sql_query(model, query, query_params, query_helpers)
21
17
  end
22
18
  end
23
19
 
24
- def self.run_active_record_query(active_record_call, query_helpers, query_type)
25
- case query_type
26
- when "single_record"
20
+ def self.run_active_record_query(active_record_call, query_helpers, single_record=false)
21
+ if single_record
27
22
  single_record_active_record_query(active_record_call, query_helpers)
28
- when "paginated"
23
+ elsif query_helpers[:per_page] || query_helpers[:page]
29
24
  paginated_active_record_query(active_record_call, query_helpers)
30
- when "all"
25
+ else
31
26
  active_record_query(active_record_call, query_helpers)
32
27
  end
33
28
  end
@@ -1,3 +1,3 @@
1
1
  module PatternQueryHelper
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pattern_query_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan McDaniel