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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c24377c49a51265afaddbcc4a5a2c595a408e5a7
4
- data.tar.gz: c1cdf33d9fd1fb2fa603830f532bb8f37498bbfe
3
+ metadata.gz: affd888942cfb7bbac784fd91eef29c15b1d157b
4
+ data.tar.gz: b76273d0e917aec6d45e141175014547235c19f2
5
5
  SHA512:
6
- metadata.gz: 06d289a95c37300bd77ec74d7fb5f162a5c50fc2fab77b2db4e23e1ca0f9ffeecf806d53577ac5b535cf9b499ef801f4ac8dbe4f2d7b5e4cc6c940f79bd52700
7
- data.tar.gz: 505a8fa5f671a0c481b0f6244298eacf7f5e9e92db7d1ebde08e8a2451b81673961387f85e207c4e7687d914e0d7c94374d93f7c869b827d085ce003836e2c73
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
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.10"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  spec.add_development_dependency "minitest"
24
+ spec.add_development_dependency 'coveralls'
24
25
  end
@@ -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
- (@floor..@ceiling).overlaps?(actual_start..actual_end)
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
@@ -1,3 +1,3 @@
1
1
  module DataFilter
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
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.1.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-15 00:00:00.000000000 Z
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