range_utils 1.2.1 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8e7990f6efd2ab806a7e7a4e1a5dbacc80f2ba6b
4
+ data.tar.gz: e38bd6ca3eb8f2a893ff2ec33ff421ba6e090ac3
5
+ SHA512:
6
+ metadata.gz: 229bf992c5826eff60d224829de0a1aaa676b79ae48df8db16277503d06f174efbe20b9f5e1df9fcca04ca2c8aa7995405059bffa013e04c570e8dd1f8ad2ba6
7
+ data.tar.gz: a4d48beba8735bc952a8c239b80ccb0535a82f14db83b81a883f49fdbfa63e2ad181c98ebc56fae0d2c10a694b2b770486c722282b436fc758bbff208f235ce8
data/Gemfile CHANGED
@@ -6,5 +6,5 @@ group :development do
6
6
  gem "rspec", "~> 3.0"
7
7
  gem "rdoc", "~> 3.12"
8
8
  gem "bundler", "~> 1.0"
9
- gem "jeweler", "1.8.4"
9
+ gem "jeweler"
10
10
  end
data/README.md CHANGED
@@ -23,7 +23,7 @@ It is mainly useful for working with batches of IDs and HTTP content ranges.
23
23
  RangeUtils.ranges_of_offfsets_for_size(3, 1) #=> [0..0, 1..1, 2..2]
24
24
 
25
25
  # Split a large Range into smaller ranges of given maximum size:
26
- RangeUtils.split_range_into_subranges_of(0..7, 3) #=> [0..2, 3..5, 5..7]
26
+ RangeUtils.split_range_into_subranges_of(0..7, 3) #=> [0..2, 3..5, 6..7]
27
27
 
28
28
  # Prepare a number of HTTP Range headers (each request will be 1 byte):
29
29
  RangeUtils.http_ranges_for_size(3, 1) #=> [0..0, 1..1, 2..2]
data/lib/range_utils.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  module RangeUtils
2
- VERSION = '1.2.1'
2
+ VERSION = '1.3.1'
3
+
4
+ NegativeRangeSpan = Class.new(ArgumentError)
3
5
 
4
6
  # Tells whether the +item+ is included in the +range+, without enumerating
5
7
  # through the +range+ (performing a quick bounds check).
@@ -88,7 +90,7 @@ module RangeUtils
88
90
  # Range members must support aruthmetic with integers.
89
91
  def size_from_range(range)
90
92
  size = range.end - range.begin + 1
91
- raise ArgumentError, "The resulting size for range #{range} is negative" if size < 0
93
+ raise NegativeRangeSpan, "The resulting size for range #{range} is negative" if size < 0
92
94
  size
93
95
  end
94
96
 
data/range_utils.gemspec CHANGED
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: range_utils 1.3.1 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "range_utils"
8
- s.version = "1.2.1"
9
+ s.version = "1.3.1"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Julik Tarkhanov"]
12
- s.date = "2015-08-25"
14
+ s.date = "2015-11-26"
13
15
  s.description = "There is a whole range of things you can do with a Range"
14
16
  s.email = "me@julik.nl"
15
17
  s.extra_rdoc_files = [
@@ -30,29 +32,28 @@ Gem::Specification.new do |s|
30
32
  ]
31
33
  s.homepage = "http://github.com/julik/range_utils"
32
34
  s.licenses = ["MIT"]
33
- s.require_paths = ["lib"]
34
- s.rubygems_version = "1.8.23.2"
35
+ s.rubygems_version = "2.2.2"
35
36
  s.summary = "Range splice, split and other niceties"
36
37
 
37
38
  if s.respond_to? :specification_version then
38
- s.specification_version = 3
39
+ s.specification_version = 4
39
40
 
40
41
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
41
42
  s.add_development_dependency(%q<rspec>, ["~> 3.0"])
42
43
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
43
44
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
44
- s.add_development_dependency(%q<jeweler>, ["= 1.8.4"])
45
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
45
46
  else
46
47
  s.add_dependency(%q<rspec>, ["~> 3.0"])
47
48
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
48
49
  s.add_dependency(%q<bundler>, ["~> 1.0"])
49
- s.add_dependency(%q<jeweler>, ["= 1.8.4"])
50
+ s.add_dependency(%q<jeweler>, [">= 0"])
50
51
  end
51
52
  else
52
53
  s.add_dependency(%q<rspec>, ["~> 3.0"])
53
54
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
54
55
  s.add_dependency(%q<bundler>, ["~> 1.0"])
55
- s.add_dependency(%q<jeweler>, ["= 1.8.4"])
56
+ s.add_dependency(%q<jeweler>, [">= 0"])
56
57
  end
57
58
  end
58
59
 
@@ -149,7 +149,7 @@ describe "RangeUtils" do
149
149
  it 'raises an ArgumentError when the range goes into negative' do
150
150
  expect{
151
151
  subject.size_from_range(0..-15)
152
- }.to raise_error(ArgumentError, 'The resulting size for range 0..-15 is negative')
152
+ }.to raise_error(RangeUtils::NegativeRangeSpan, 'The resulting size for range 0..-15 is negative')
153
153
  end
154
154
 
155
155
  it 'computes the right size from the given Range' do
metadata CHANGED
@@ -1,80 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: range_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
5
- prerelease:
4
+ version: 1.3.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Julik Tarkhanov
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-08-25 00:00:00.000000000 Z
11
+ date: 2015-11-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '3.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rdoc
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: '3.12'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: '3.12'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: bundler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '1.0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: '1.0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: jeweler
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - '='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
- version: 1.8.4
61
+ version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - '='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
- version: 1.8.4
68
+ version: '0'
78
69
  description: There is a whole range of things you can do with a Range
79
70
  email: me@julik.nl
80
71
  executables: []
@@ -83,9 +74,9 @@ extra_rdoc_files:
83
74
  - LICENSE.txt
84
75
  - README.md
85
76
  files:
86
- - .document
87
- - .rspec
88
- - .travis.yml
77
+ - ".document"
78
+ - ".rspec"
79
+ - ".travis.yml"
89
80
  - Gemfile
90
81
  - LICENSE.txt
91
82
  - README.md
@@ -96,29 +87,25 @@ files:
96
87
  homepage: http://github.com/julik/range_utils
97
88
  licenses:
98
89
  - MIT
90
+ metadata: {}
99
91
  post_install_message:
100
92
  rdoc_options: []
101
93
  require_paths:
102
94
  - lib
103
95
  required_ruby_version: !ruby/object:Gem::Requirement
104
- none: false
105
96
  requirements:
106
- - - ! '>='
97
+ - - ">="
107
98
  - !ruby/object:Gem::Version
108
99
  version: '0'
109
- segments:
110
- - 0
111
- hash: 4395321895595223882
112
100
  required_rubygems_version: !ruby/object:Gem::Requirement
113
- none: false
114
101
  requirements:
115
- - - ! '>='
102
+ - - ">="
116
103
  - !ruby/object:Gem::Version
117
104
  version: '0'
118
105
  requirements: []
119
106
  rubyforge_project:
120
- rubygems_version: 1.8.23.2
107
+ rubygems_version: 2.2.2
121
108
  signing_key:
122
- specification_version: 3
109
+ specification_version: 4
123
110
  summary: Range splice, split and other niceties
124
111
  test_files: []