better_ranges 1.1.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d04f8f961e79e072b4f76c04a5d24c56a2dc6ed5
4
- data.tar.gz: 6c0041e4a5e835d3d48e4e45644700fbe2f837f3
3
+ metadata.gz: 62d2b490dbe53332a036fd6be51bd95f91b60602
4
+ data.tar.gz: 66cc985c6891427691f973079eca51c0599742b0
5
5
  SHA512:
6
- metadata.gz: 673874f7f3571d50b407737720a377d1294901a83301643395eddf1c458022dce9e3ad028153bd49798bc9cc659a3d0c6bf369b5f5bde22614dfaf29ecfe1da0
7
- data.tar.gz: 91c59ea36adddae6243a8033992560c9b35d2baf7177309e0252239893f93a715efcb5037a44182cfe50062a18b760b81935e9c4d2e3f4a2587ee4d06559a737
6
+ metadata.gz: ba081c6e3883e3a6880f2f96e1c6ada0be0fe808811e6b43ebfdb4918ba7b0e4bd0c58e6d6d9d6a6481e6e66dde34968e3414f4dfec374be7f6395ca33161b90
7
+ data.tar.gz: 4708086e998060c9e631e20a2a632be0d2bcae48dd4ad0a5b7a0c27de8b174a3788d99aaa5319ab05705f33a5298f62a4b0f7ca580a24ddfd16d0c7cbe05961d
@@ -18,6 +18,7 @@ module BetterRanges
18
18
  alias_method :union, :|
19
19
 
20
20
  alias_method :minus, :-
21
+ alias_method :difference, :-
21
22
  alias_method :intersect, :&
22
23
  end
23
24
  end
@@ -21,6 +21,12 @@ module BetterRanges
21
21
  end.each(&block)
22
22
  end
23
23
 
24
+ def sparse_each(&block)
25
+ @data.each do |x|
26
+ x.is_a?(Range) ? x : (x..x)
27
+ end
28
+ end
29
+
24
30
  def step(num = 1, &block)
25
31
  i = 0
26
32
  Enumerator.new do |yielder|
@@ -160,6 +166,7 @@ module BetterRanges
160
166
  alias_method :union, :|
161
167
 
162
168
  alias_method :minus, :-
169
+ alias_method :difference, :-
163
170
  alias_method :intersect, :&
164
171
 
165
172
  alias_method :add, :<<
@@ -1,3 +1,3 @@
1
1
  module BetterRanges
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
  include BetterRanges
3
3
 
4
4
  describe BetterRanges::SparseRange do
5
- context 'subtraction(#-)' do
5
+ context 'difference(#-)' do
6
6
  it 'should work' do
7
7
  a = SparseRange.new(-20..-10, 1..25, 50..75, 100..200, 300..400, 500..600, 700..800, 900)
8
8
  b = SparseRange.new(-5..-1, 5..15, 40..80, 90..125, 150..225, 250..350, 550..650, 750, 850..950, 1000)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_ranges
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Ziminsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-08 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler