apill 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/apill/parameters/filter.rb +7 -2
- data/lib/apill/version.rb +1 -1
- data/spec/apill/resource/processors/filtering_spec.rb +6 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82eff4962347e3b4c65a8223c44d57728b42b327
|
4
|
+
data.tar.gz: a8bdd368f13006347c8598336ad95205bb98efc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63b7196beff9b5535f9734c2abd8674623fcb139682e0dd42ee63cc57720402bc7cd829f2311dfcc83dfcfa1e0b2c3e7c8834e640d60e44be5b45d202c3c146f
|
7
|
+
data.tar.gz: 8eeb02a3792009cba05528d7469a4aa0d89624a98f6ac47098a2fc45f0b05bbbb06ebc795d4e0f5d1e77ca070754039699d8e84b7e968d969e5b889bedf57f22
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Apill
|
2
2
|
class Parameters
|
3
3
|
class Filter
|
4
|
-
|
4
|
+
NUMERICAL = /[\d_\.]+?/
|
5
|
+
NUMERICAL_RANGE = /\A(#{NUMERICAL})\.\.\.?(#{NUMERICAL}|Infinity)\z/
|
5
6
|
|
6
7
|
attr_accessor :raw_parameters
|
7
8
|
|
@@ -38,7 +39,11 @@ class Filter
|
|
38
39
|
if range_points = value.match(NUMERICAL_RANGE)
|
39
40
|
exclusive = value.include? '...'
|
40
41
|
starting_point = range_points[1].to_f
|
41
|
-
ending_point = range_points[2]
|
42
|
+
ending_point = if range_points[2] == 'Infinity'
|
43
|
+
Float::INFINITY
|
44
|
+
else
|
45
|
+
range_points[2].to_f
|
46
|
+
end
|
42
47
|
|
43
48
|
Range.new(starting_point, ending_point, exclusive)
|
44
49
|
else
|
data/lib/apill/version.rb
CHANGED
@@ -67,14 +67,18 @@ describe Filtering do
|
|
67
67
|
filtering = Filtering.new(filtering_resource,
|
68
68
|
'filter' => {
|
69
69
|
'stuff' => '100...200',
|
70
|
-
'
|
70
|
+
'infinity' => '9...Infinity',
|
71
|
+
'other_stuff' => '3_333.33..8_8__8.0',
|
71
72
|
})
|
72
73
|
|
73
74
|
allow(filtering_resource).to receive(:for_stuff).
|
74
75
|
with(100.0...200.0).
|
75
76
|
and_return filtering_resource
|
77
|
+
allow(filtering_resource).to receive(:infinity).
|
78
|
+
with(9...Float::INFINITY).
|
79
|
+
and_return filtering_resource
|
76
80
|
allow(filtering_resource).to receive(:other_stuff).
|
77
|
-
with(
|
81
|
+
with(3333.33..888.0).
|
78
82
|
and_return 'other_stuffed'
|
79
83
|
|
80
84
|
expect(filtering.processed).to eql 'other_stuffed'
|