page_up 0.0.11 → 0.0.12

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: a5c271fd062de9397f81bb1225dd72b0b2f22cc2
4
- data.tar.gz: b0d85101ceea1da3d58139ce2416c09d2d27b68b
3
+ metadata.gz: 37a199ec307390fa484222d921ce7e44d1c1fbcc
4
+ data.tar.gz: ef1a8bd2fda2d1364263a6183b3534cfce05f35d
5
5
  SHA512:
6
- metadata.gz: b77e0ac8a38017a6ffbdbe2293d1beea0a9d65445403ac925914607dd3e334a77ba4fb3fcf025b29af1cea3361c85f4594afb0d697c8c12de1b0b4a88687ba44
7
- data.tar.gz: 9249c94dfb6a51d8a5f31ce599283d8d998c1547835589a93220273f68659310281edc6a2cb16d7438ea8f284308822d9b9ba2a3b3d2fd75ed56c74c3507e1a0
6
+ metadata.gz: c896f4d1225d9e0054735a88a01fd31c19b94a58c2a4b2894902e21fd5a9495875eaf331ac82cfb0deb0a9a1b7ccb458611f42e374fcb20f18b4ec9b93dbffb5
7
+ data.tar.gz: b235f20a0f9d61b64624bae4f53281e6dab714eb0e82664cac1fbe3d34a4b072be31e40dce25a2ff38bcada796b66a599335625260bc25259da3b0a9eef8fc12
data/lib/page_up/pages.rb CHANGED
@@ -7,7 +7,7 @@ module PageUp
7
7
  @per_page = parse per_page, 25
8
8
  @origin = collection
9
9
  @opts = opts
10
- super collection[page_range]
10
+ super (collection[page_range] || [])
11
11
  end
12
12
 
13
13
  def total_size
@@ -1,3 +1,3 @@
1
1
  module PageUp
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -58,4 +58,11 @@ describe "pagination" do
58
58
  specify { expect(PageUp[collection,3,5].current_slice).to eq 1..3 }
59
59
  end
60
60
 
61
+ it "handles partial pages" do
62
+ expect(PageUp[(1..5).to_a,1, 10]).to eq (1..5).to_a
63
+ end
64
+
65
+ it "handles pages out of range" do
66
+ expect(PageUp[(1..5).to_a,2, 10]).to eq []
67
+ end
61
68
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Rowe