querier 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/querier.rb +4 -4
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee6931c618aea1c0988e7a45c390e81a6e5270472eb2963bbf8db0dfd176a9be
4
- data.tar.gz: 9bb96c0447914e61a32a4f7efe2c77fbeba1a800829baa2e40f02bdf91733042
3
+ metadata.gz: fd47eff36c3f752f277ce56bcd18635ef34f9a79d7765fdd91b56ae20f06444d
4
+ data.tar.gz: 6f95ffd91d3e52181eeb33ddc2f0fd3a444035365542f774c7b9ad8c923962e7
5
5
  SHA512:
6
- metadata.gz: dc2b2fe45f7b0ce58ee79a5000075896d39bca6aae1f7ab356f7f27e0b993a73af1b5339911255c1f37db6d4c9c9df6b25e28636faa80d7384b9095e0ef1a10a
7
- data.tar.gz: 91c329ad6eb8f3d19cef96d5afaa29fab6651df37e919b2b92da636346dbd2cff4340190be4a236e3a26175acf839e147b342d99d814edeb80e534583e9d5119
6
+ metadata.gz: 5a861883fac193952c33733c58ed2701d7424ad22196618d199fdd7a469075d0689196baa2cea9d0c3e5ac212ba99a252aff9d2670cdc4a382da4d844839615f
7
+ data.tar.gz: 343f454ff2489dea937cc6906c262d214383efb2b63d774a1e0f240b113691d04805f3f0e9656e50d1b539e35933a550bfe3af35e303bcb7d2cbfce8cf706df0
@@ -58,9 +58,9 @@ class Querier
58
58
  dataset.map {|record| OpenStruct.new(record.symbolize_keys!)}
59
59
  end
60
60
 
61
- def get_param_value raw_query_param
61
+ def get_param_value raw_query_param, quotefy_param=true
62
62
  # where's String#quote when we need it?
63
- raw_query_param.class.eql?(String) ? "'#{raw_query_param.to_s}'" : raw_query_param.to_s
63
+ raw_query_param.class.eql?(String) && quotefy_param ? "'#{raw_query_param.to_s}'" : raw_query_param.to_s
64
64
  end
65
65
 
66
66
  def fill_query_params query_template:, query_params:
@@ -68,9 +68,9 @@ class Querier
68
68
 
69
69
  query_params.each do |query_param|
70
70
  query_param_name = query_param[PARAM_NAME_INDEX].to_s
71
- query_param_value = get_param_value(query_param[PARAM_VALUE_INDEX])
72
71
 
73
- query.gsub! /{\?#{query_param_name}}/, query_param_value
72
+ query.gsub! /{\?#{query_param_name}}/, get_param_value(query_param[PARAM_VALUE_INDEX], true)
73
+ query.gsub! /{\?#{query_param_name}\/no_quote}/, get_param_value(query_param[PARAM_VALUE_INDEX], false)
74
74
  end
75
75
 
76
76
  query
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: querier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gedean Dias
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-29 00:00:00.000000000 Z
11
+ date: 2018-08-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Active Record queries with variable number of params
14
14
  email: gedean.dias@gmail.com
@@ -38,7 +38,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  version: '0'
39
39
  requirements: []
40
40
  rubyforge_project:
41
- rubygems_version: 2.7.4
41
+ rubygems_version: 2.7.7
42
42
  signing_key:
43
43
  specification_version: 4
44
44
  summary: Active Record Querier