data_filter 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/data_filter.gemspec +1 -0
- data/lib/data_filter/range_overlap_filter.rb +18 -1
- data/lib/data_filter/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: affd888942cfb7bbac784fd91eef29c15b1d157b
|
4
|
+
data.tar.gz: b76273d0e917aec6d45e141175014547235c19f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1155098d7771a6fdcd50938918e77bb60fc40cb36401e4db4e2fc7a485d260fa248152440d75e4c19b442fa3e7904f66be7a5ea2793fc8134f5791abd0328fc
|
7
|
+
data.tar.gz: f06a4205f198f30b1ede769a4868ae162a5c89891b608712efb3d11a4ff6495ad6f333c52b9f5d669a27f44446db537065f40216ebaa00c091b355609d233f02
|
data/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# DataFilter
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/data_filter.svg)](http://badge.fury.io/rb/data_filter)
|
4
|
+
[![Build Status](https://travis-ci.org/backupify/data_filter.svg)](https://travis-ci.org/backupify/data_filter)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/backupify/data_filter/badge.svg?branch=master&service=github)](https://coveralls.io/github/backupify/data_filter?branch=master)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/backupify/data_filter/badges/gpa.svg)](https://codeclimate.com/github/backupify/data_filter)
|
7
|
+
|
3
8
|
an extensible DSL for filtering data sets
|
4
9
|
|
5
10
|
## Installation
|
@@ -43,6 +48,14 @@ data = [
|
|
43
48
|
filter_set.call(data)
|
44
49
|
```
|
45
50
|
|
51
|
+
## Changelog
|
52
|
+
|
53
|
+
```
|
54
|
+
* v0.2.0
|
55
|
+
|
56
|
+
- Fix RangeOverlapFilter edge cases
|
57
|
+
```
|
58
|
+
|
46
59
|
## License
|
47
60
|
|
48
61
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/data_filter.gemspec
CHANGED
@@ -45,8 +45,25 @@ module DataFilter
|
|
45
45
|
|
46
46
|
# :nodoc:
|
47
47
|
def in_range?(actual_start, actual_end)
|
48
|
+
return true if @floor.nil? && @ceiling.nil?
|
48
49
|
return false if actual_start.nil? || actual_end.nil?
|
49
|
-
|
50
|
+
|
51
|
+
# TODO should this sort the start and end?
|
52
|
+
# by default Ranges like (2..0) will have no elements
|
53
|
+
actual_range = (actual_start..actual_end)
|
54
|
+
|
55
|
+
if @floor.nil?
|
56
|
+
actual_range.include?(@ceiling) || actual_range.max <= @ceiling
|
57
|
+
elsif @ceiling.nil?
|
58
|
+
actual_range.include?(@floor) || actual_range.min >= @floor
|
59
|
+
else
|
60
|
+
overlaps?((@floor..@ceiling), actual_range)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Snipped from ActiveSupport
|
65
|
+
def overlaps?(range_a, range_b)
|
66
|
+
range_a.include?(range_b.first) || range_b.include?(range_a.first)
|
50
67
|
end
|
51
68
|
end
|
52
69
|
end
|
data/lib/data_filter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Bodah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description:
|
56
70
|
email:
|
57
71
|
- jb3689@yahoo.com
|