page_up 0.0.10 → 0.0.11

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: 309a61fb2f297b15b8cb13c9518c51d2e75b56e1
4
- data.tar.gz: c83e8b9629202e333d41be7c767d4379604d7d92
3
+ metadata.gz: a5c271fd062de9397f81bb1225dd72b0b2f22cc2
4
+ data.tar.gz: b0d85101ceea1da3d58139ce2416c09d2d27b68b
5
5
  SHA512:
6
- metadata.gz: f2a1d0bb31e7b1d1cff7fe78eae919f3cbb36227f2fd59a09938bc5f9120744b5ad9b37357d0b3d0179cb69951ef0b8c49b0d9a74c2ba664e4a294c831f2167c
7
- data.tar.gz: f8f66fd203c1ff540082fd8bdd6a15a52b17ebd9d5f46ad6ca5217c84659b767fd4abdfc74daa2f8fc4ea3a89648a76c692efc69b36e55de761445ac34d4e723
6
+ metadata.gz: b77e0ac8a38017a6ffbdbe2293d1beea0a9d65445403ac925914607dd3e334a77ba4fb3fcf025b29af1cea3361c85f4594afb0d697c8c12de1b0b4a88687ba44
7
+ data.tar.gz: 9249c94dfb6a51d8a5f31ce599283d8d998c1547835589a93220273f68659310281edc6a2cb16d7438ea8f284308822d9b9ba2a3b3d2fd75ed56c74c3507e1a0
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.0
3
+ - 2.1.2
4
4
  - 2.0.0
5
5
  - 1.9.3
6
6
  - 1.9.2
7
7
  - jruby-19mode
8
- - rbx
8
+ - rbx-2
@@ -22,6 +22,10 @@ module PageUp
22
22
  @fragment[range].compact
23
23
  end
24
24
 
25
+ def to_a
26
+ self[0..@size].to_a
27
+ end
28
+
25
29
  def use &block
26
30
  @callback = block
27
31
  end
@@ -1,3 +1,3 @@
1
1
  module PageUp
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
data/page_up.gemspec CHANGED
@@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rspec", "~> 2.14.0"
23
+ spec.add_development_dependency "bundler"
24
+ spec.add_development_dependency "rspec", "~> 3.0.0"
25
25
  end
@@ -20,6 +20,7 @@ describe 'fragmented pages' do
20
20
 
21
21
  context 'when the range is outside the fragment' do
22
22
  let(:pages_requested) { [] }
23
+ let(:pages) { PageUp::Fragment.new fragment, 2, 20, source.size }
23
24
 
24
25
  before do
25
26
  pages.use do |page, per_page|
@@ -38,6 +39,10 @@ describe 'fragmented pages' do
38
39
  expect(pages_requested).to eq [[4,20]]
39
40
  end
40
41
 
42
+ it 'will retrieve earlier results if it has to' do
43
+ expect(pages[0...20]).to eq (1..20).to_a
44
+ end
45
+
41
46
  it 'will call the block multiple times if required' do
42
47
  pages[70...90]
43
48
  expect(pages_requested).to eq [[4,20],[5,20]]
@@ -47,6 +52,10 @@ describe 'fragmented pages' do
47
52
  expect(pages[70...90]).to eq (71..90).to_a
48
53
  end
49
54
 
55
+ it 'will collect all results if necessary' do
56
+ expect(pages.to_a).to eq source
57
+ end
58
+
50
59
  it 'protects against ranges that exceed the existing data' do
51
60
  Timeout.timeout(0.3) do
52
61
  expect(pages[90...110]).to eq (91..100).to_a
metadata CHANGED
@@ -1,35 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Rowe
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDVjCCAj6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBRMQ4wDAYDVQQDDAVoZWxs
14
- bzEXMBUGCgmSJomT8ixkARkWB2pvbnJvd2UxEjAQBgoJkiaJk/IsZAEZFgJjbzES
15
-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1GzjLQUq
31
- -----END CERTIFICATE-----
32
- date: 2014-03-03 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2014-08-18 00:00:00.000000000 Z
33
12
  dependencies:
34
13
  - !ruby/object:Gem::Dependency
35
14
  name: rake
@@ -49,30 +28,30 @@ dependencies:
49
28
  name: bundler
50
29
  requirement: !ruby/object:Gem::Requirement
51
30
  requirements:
52
- - - "~>"
31
+ - - ">="
53
32
  - !ruby/object:Gem::Version
54
- version: '1.3'
33
+ version: '0'
55
34
  type: :development
56
35
  prerelease: false
57
36
  version_requirements: !ruby/object:Gem::Requirement
58
37
  requirements:
59
- - - "~>"
38
+ - - ">="
60
39
  - !ruby/object:Gem::Version
61
- version: '1.3'
40
+ version: '0'
62
41
  - !ruby/object:Gem::Dependency
63
42
  name: rspec
64
43
  requirement: !ruby/object:Gem::Requirement
65
44
  requirements:
66
45
  - - "~>"
67
46
  - !ruby/object:Gem::Version
68
- version: 2.14.0
47
+ version: 3.0.0
69
48
  type: :development
70
49
  prerelease: false
71
50
  version_requirements: !ruby/object:Gem::Requirement
72
51
  requirements:
73
52
  - - "~>"
74
53
  - !ruby/object:Gem::Version
75
- version: 2.14.0
54
+ version: 3.0.0
76
55
  description: Simple paginator
77
56
  email:
78
57
  - hello@jonrowe.co.uk
checksums.yaml.gz.sig DELETED
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file