directiverecord 0.1.29 → 0.1.30

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: 1bfe5ca92925fd12668d8679e9a93f5db099f29f
4
- data.tar.gz: b77c4c85e6ecd7ab12b3cf3dbb685ef29bb7f74e
3
+ metadata.gz: 8af004fe8d656116a9a968b0ceea0a5c558685cc
4
+ data.tar.gz: 3835a1b1137052e19f2994688fb48ab8412963ba
5
5
  SHA512:
6
- metadata.gz: 7dd096afe893a680a35ebe1132f046cf6bee6c5f335a83f43c844ebe0c7a5b699dc1672615f1c7f264e31ca6f11ca1eeeeb67627cd2f11f9672b9d2d2476edae
7
- data.tar.gz: c215ece54c252766a1ef0163bca6d135549752947bbbb2dd8f66df5f96b84592f2c0f8ab73a0c260959b7dc2d71c547f2468defca5c87283f99a3a6605d56f07
6
+ metadata.gz: 72a42dd40f987a4467f51a2dfb79964fd4e2b90b7d2c38cfd36acf31ee48f0ed97a343ed950e41d95695c8a272803b7f425060f10c8ecb674ab9948985e88e80
7
+ data.tar.gz: eb544e7122a967db1e3929398070b8a0a85eca0bd4a5cc1e3a6ce207e47f1a879996e421ae063dcbe1f24a4d6dde2b1cd76d307b390a6766eabf4fc6bf05d19e
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,11 @@
1
1
  = DirectiveRecord CHANGELOG
2
2
 
3
+ == Version 0.1.30 (August 26, 2015)
4
+
5
+ * Made the :group_by, :having and :order_by option correction more strict
6
+ * Respecting optionally passed :where option when invoking #(to_)qry on a relation scope
7
+ * Improved distinguishing WHERE from HAVING statements
8
+
3
9
  == Version 0.1.29 (August 17, 2015)
4
10
 
5
11
  * Not normalizing select option again after having encountered new calculated columns in the GROUP BY statement, instead just register the alias
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.29
1
+ 0.1.30
@@ -48,7 +48,7 @@ module DirectiveRecord
48
48
  keys.each do |key|
49
49
  if value = options[key]
50
50
  value = value.join delimiter
51
- aliases.each{|pattern, replacement| value.gsub! pattern, replacement}
51
+ aliases.each{|pattern, replacement| value.gsub! /(?=\b|\s)#{Regexp.escape pattern}(?=\b|\s)/, replacement}
52
52
  options[key] = value
53
53
  end
54
54
  end
@@ -24,7 +24,7 @@ module DirectiveRecord
24
24
  [:group_by, :having, :order_by].each do |key|
25
25
  if value = options[key]
26
26
  value = value.join ", "
27
- aliases.each{|pattern, replacement| value.gsub! pattern, replacement}
27
+ aliases.each{|pattern, replacement| value.gsub! /(?=\b|\s)#{Regexp.escape pattern}(?=\b|\s)/, replacement}
28
28
  options[key] = value
29
29
  end
30
30
  end
@@ -253,7 +253,7 @@ SQL
253
253
  end
254
254
 
255
255
  def normalize_where!(options)
256
- regexp, aliases = /^\S+/, options[:aliases].invert
256
+ regexp, aliases = /^\S+/, options[:aliases].to_a.flatten.uniq.sort
257
257
 
258
258
  where, having = (options[:where] || []).partition do |statement|
259
259
  !options[:aggregated].keys.include?(statement.strip.match(regexp).to_s) &&
@@ -13,7 +13,7 @@ module DirectiveRecord
13
13
  options.merge(
14
14
  {
15
15
  :select => (select.blank? ? ".*" : select),
16
- :where => where_values.collect{|x| sql_aliases_to_paths(x)},
16
+ :where => where_values.collect{|x| sql_aliases_to_paths(x)} + [options[:where]].flatten.compact,
17
17
  :group_by => group_values.collect{|x| sql_aliases_to_paths(x)},
18
18
  :order_by => order_values.collect{|x| sql_aliases_to_paths(x)},
19
19
  :limit => limit_value,
@@ -1,7 +1,7 @@
1
1
  module DirectiveRecord
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- TINY = 29
4
+ TINY = 30
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: directiverecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.29
4
+ version: 0.1.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Engel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-17 00:00:00.000000000 Z
11
+ date: 2015-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord