query_string_interface 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +14 -12
- data/lib/query_string_interface/parsers/date_time_parser.rb +3 -1
- data/lib/query_string_interface/version.rb +1 -1
- metadata +1 -1
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
query_string_interface (0.
|
4
|
+
query_string_interface (0.3.0)
|
5
5
|
activesupport (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (3.1.
|
10
|
+
activesupport (3.1.3)
|
11
11
|
multi_json (~> 1.0)
|
12
12
|
archive-tar-minitar (0.5.2)
|
13
|
-
columnize (0.3.
|
13
|
+
columnize (0.3.5)
|
14
14
|
diff-lcs (1.1.3)
|
15
15
|
i18n (0.6.0)
|
16
16
|
linecache (0.46)
|
17
17
|
rbx-require-relative (> 0.0.4)
|
18
18
|
linecache19 (0.5.12)
|
19
19
|
ruby_core_source (>= 0.1.4)
|
20
|
-
multi_json (1.0.
|
20
|
+
multi_json (1.0.4)
|
21
21
|
rake (0.8.7)
|
22
22
|
rbx-require-relative (0.0.5)
|
23
|
-
rspec (2.
|
24
|
-
rspec-core (~> 2.
|
25
|
-
rspec-expectations (~> 2.
|
26
|
-
rspec-mocks (~> 2.
|
27
|
-
rspec-core (2.
|
28
|
-
rspec-expectations (2.
|
23
|
+
rspec (2.7.0)
|
24
|
+
rspec-core (~> 2.7.0)
|
25
|
+
rspec-expectations (~> 2.7.0)
|
26
|
+
rspec-mocks (~> 2.7.0)
|
27
|
+
rspec-core (2.7.1)
|
28
|
+
rspec-expectations (2.7.0)
|
29
29
|
diff-lcs (~> 1.1.2)
|
30
|
-
rspec-mocks (2.
|
30
|
+
rspec-mocks (2.7.0)
|
31
31
|
ruby-debug (0.10.4)
|
32
32
|
columnize (>= 0.1)
|
33
33
|
ruby-debug-base (~> 0.10.4.0)
|
@@ -43,10 +43,11 @@ GEM
|
|
43
43
|
ruby-debug-base19 (>= 0.11.19)
|
44
44
|
ruby_core_source (0.1.5)
|
45
45
|
archive-tar-minitar (>= 0.5.2)
|
46
|
-
simplecov (0.5.
|
46
|
+
simplecov (0.5.4)
|
47
47
|
multi_json (~> 1.0.3)
|
48
48
|
simplecov-html (~> 0.5.3)
|
49
49
|
simplecov-html (0.5.3)
|
50
|
+
tzinfo (0.3.31)
|
50
51
|
|
51
52
|
PLATFORMS
|
52
53
|
ruby
|
@@ -59,3 +60,4 @@ DEPENDENCIES
|
|
59
60
|
ruby-debug
|
60
61
|
ruby-debug19
|
61
62
|
simplecov
|
63
|
+
tzinfo
|
@@ -1,13 +1,15 @@
|
|
1
1
|
module QueryStringInterface
|
2
2
|
module Parsers
|
3
3
|
class DateTimeParser
|
4
|
-
DATE_REGEX = /^(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[T \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?([ \t]*)(Z?|[
|
4
|
+
DATE_REGEX = /^(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[T \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?([ \t]*)(Z?|[-+\s]\d{2}?(:?\d{2})?))$/
|
5
|
+
ESCAPED_ZONE_REGEX = /\s(\d{2}:\d{2})$/
|
5
6
|
|
6
7
|
def parseable?(value, operator)
|
7
8
|
DATE_REGEX.match(value)
|
8
9
|
end
|
9
10
|
|
10
11
|
def parse(value)
|
12
|
+
value.gsub!(ESCAPED_ZONE_REGEX) { "+#{$1}" }
|
11
13
|
Time.parse(value)
|
12
14
|
end
|
13
15
|
end
|