moving_window 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/moving_window.rb +7 -2
- metadata +26 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b8600921fac71e7f9661fc55c24156011f52036
|
4
|
+
data.tar.gz: 212a3dc680424c2129aaca29e66cf458569fe891
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4132eee6b7f1d00d9e3dc6e5fa08e977705d395a45cb80c83b722ae7de43ee8c1e779220283a739278cbd73cd5662549aa9574f2b5dc0bf0b283363aa94e4166
|
7
|
+
data.tar.gz: 9be3dd82e9c55aba23fbd7d2b80011339125f9745dd412b1795f1778aeafa7c64ac05ade8a03dbbb9ab730d298f04af0ed9ff802eaefa2c8cd7d5335422f1527
|
data/lib/moving_window.rb
CHANGED
@@ -13,8 +13,8 @@ class MovingWindow
|
|
13
13
|
|
14
14
|
def filter(scope, params = {})
|
15
15
|
column, qualifier = parse(params)
|
16
|
-
|
17
|
-
scope.where(["#{
|
16
|
+
query = columns_sql(scope.table_name, Array.wrap(column))
|
17
|
+
scope.where(["#{query} #{qualifier} ? and ?", *timestamps])
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
@@ -31,6 +31,11 @@ class MovingWindow
|
|
31
31
|
[from, to].sort
|
32
32
|
end
|
33
33
|
|
34
|
+
def columns_sql(table_name, columns)
|
35
|
+
columns_string = columns.map { |name| "#{table_name}.#{name}" }.join(',')
|
36
|
+
columns.length > 1 ? "COALESCE(#{columns_string})" : columns_string
|
37
|
+
end
|
38
|
+
|
34
39
|
class Proc < ::Proc
|
35
40
|
attr_writer :negate
|
36
41
|
|
metadata
CHANGED
@@ -1,55 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moving_window
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Patuzzo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - '
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.2.22
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.2.22
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sqlite3
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
description: A helper for building scopes that deal with moving windows.
|
@@ -69,17 +83,17 @@ require_paths:
|
|
69
83
|
- lib
|
70
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
85
|
requirements:
|
72
|
-
- -
|
86
|
+
- - ">="
|
73
87
|
- !ruby/object:Gem::Version
|
74
88
|
version: '0'
|
75
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
90
|
requirements:
|
77
|
-
- -
|
91
|
+
- - ">="
|
78
92
|
- !ruby/object:Gem::Version
|
79
93
|
version: '0'
|
80
94
|
requirements: []
|
81
95
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.6.7
|
83
97
|
signing_key:
|
84
98
|
specification_version: 4
|
85
99
|
summary: Moving Window
|