page_up 0.0.7 → 0.0.8

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: 520aa3608f8c93a7891b4610ecdef4d8c9c837a3
4
- data.tar.gz: 18a9e35575f9e29a0d071389a4d399b5f0244319
3
+ metadata.gz: 20c7439062000ee660ffbb29a6397979c0d91eb6
4
+ data.tar.gz: 3e4cf5c800a2d1829a347fb12efa7ae53f8d8799
5
5
  SHA512:
6
- metadata.gz: 84bd728ef04a9684f96b2ecbe8ab22804f5cd4f40873918c3ef98bd942a45db0a8124a0418130a29b9afc2fc6ebff78216501a297c5f9762ed4cbf45dddb23bc
7
- data.tar.gz: 8bd51972898e7bae3762a46cea8f84ec98c7989f4a792ff9e050094da80b4eac25572c99ef1e55dee5881a32a93056dbd53761ae5a2d196be9ebafc8157cbbc7
6
+ metadata.gz: e88399fce698a9795283c3aebf6adab1d3decc1b3ecde3852ba6530238c8bb914ef20b501cda85d2531b4faf260eff302c9ef62ecc5b1dc355555ccd3b25db66
7
+ data.tar.gz: 44558756fc80fa5f15e60d7776402823328b526dc1e01a57715ef09bc676df0309553bbb00a5d899f91e6201b00e6c3434ee51ec96f9ee5f7b6a8a68695edd7a
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- ?�+��;fTY��5�=�!�j8��Yg@��i�e�1��'�̞yy��Z�g#���I�%��zW����.n�u`{���_E����^��"��M��g��8l,����z��B�=d2��ª�KY��rZ��x �?��p=�zv���.�� x�"^��2ϖ����@9e���6[E<�W�H�0� ����bJ���-<׊�.`�cX����5��B$�
2
- �R[����Bp���ctj�XyU����p�^
1
+ QIt{6\� ��`�Ң"Z�Ϯ��fi�2�<`���^y8*�=�m~�������Yha_3g��KaC�SPK$ZZF%cY��l�ݵ`�=ө���
2
+ �;�T��-�QSḛf+B�t&��l�v�x;�@D�.��I��� t\y���eԆ2eqbT�����:i��|�*�2�N�ҳ9kv��C��A}f[=E/��
@@ -1,10 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.1.0
3
4
  - 2.0.0
4
5
  - 1.9.3
5
6
  - 1.9.2
6
7
  - jruby-19mode
7
- - rbx-19mode
8
- matrix:
9
- allow_failures:
10
- - ruby-head
8
+ - rbx
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in page_up.gemspec
4
4
  gemspec
5
+
6
+ platform :rbx do
7
+ gem 'rubysl'
8
+ end
@@ -3,8 +3,8 @@ require 'page_up/fragment'
3
3
 
4
4
  module PageUp
5
5
 
6
- def self.[] collection, page = nil, per_page = nil
7
- PageUp::Pages.new(collection, page, per_page)
6
+ def self.[] collection, page = nil, per_page = nil, opts = {}
7
+ PageUp::Pages.new(collection, page, per_page, opts)
8
8
  end
9
9
 
10
10
  end
@@ -2,20 +2,21 @@ require 'delegate'
2
2
  module PageUp
3
3
  class Pages < SimpleDelegator
4
4
 
5
- def initialize collection, page, per_page
5
+ def initialize collection, page, per_page, opts = {}
6
6
  @page = parse page, 1
7
7
  @per_page = parse per_page, 25
8
8
  @origin = collection
9
+ @opts = opts
9
10
  super collection[page_range]
10
11
  end
11
12
 
12
13
  def total_size
13
- @origin.size
14
+ @opts.fetch(:total_size) { @origin.size }
14
15
  end
15
16
 
16
17
  def pages
17
- if @origin.size > 0
18
- (@origin.size.to_f / per_page).ceil
18
+ if total_size > 0
19
+ (total_size.to_f / per_page).ceil
19
20
  else
20
21
  1
21
22
  end
@@ -1,3 +1,3 @@
1
1
  module PageUp
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -16,9 +16,10 @@ describe "pagination" do
16
16
  end
17
17
 
18
18
  it 'paginates collections above page count' do
19
- expect(PageUp[collection,1,5]).to eq [1,2,3,4,5]
20
- expect(PageUp[collection,2,5]).to eq [6,7,8,9,10]
21
- expect(PageUp[collection,3,5]).to eq [11,12]
19
+ expect(PageUp[collection,1,3]).to eq [1, 2, 3]
20
+ expect(PageUp[collection,2,3]).to eq [4, 5, 6]
21
+ expect(PageUp[collection,3,3]).to eq [7, 8, 9]
22
+ expect(PageUp[collection,4,3]).to eq [10, 11, 12]
22
23
  end
23
24
 
24
25
  it 'counts pages' do
@@ -33,6 +34,10 @@ describe "pagination" do
33
34
  expect(PageUp[(1..100).to_a,1,5].total_size).to eq 100
34
35
  end
35
36
 
37
+ it 'allows override of total size' do
38
+ expect(PageUp[(1..10).to_a,1,5, total_size: 100].total_size).to eq 100
39
+ end
40
+
36
41
  describe 'picking the current slice' do
37
42
  specify { expect(PageUp[[],1,1].current_slice).to eq 1..1 }
38
43
  specify { expect(PageUp[[1,2,3],1,1].current_slice).to eq 1..3 }
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.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Rowe
@@ -10,10 +10,10 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDVjCCAj6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBRMQ4wDAYDVQQDDAVoZWxs
13
+ MIIDVjCCAj6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBRMQ4wDAYDVQQDDAVoZWxs
14
14
  bzEXMBUGCgmSJomT8ixkARkWB2pvbnJvd2UxEjAQBgoJkiaJk/IsZAEZFgJjbzES
15
- MBAGCgmSJomT8ixkARkWAnVrMB4XDTEzMDIwMzA4MTgwNloXDTE0MDIwMzA4MTgw
16
- NlowUTEOMAwGA1UEAwwFaGVsbG8xFzAVBgoJkiaJk/IsZAEZFgdqb25yb3dlMRIw
15
+ MBAGCgmSJomT8ixkARkWAnVrMB4XDTE0MDIwNjEwMjcxN1oXDTE1MDIwNjEwMjcx
16
+ N1owUTEOMAwGA1UEAwwFaGVsbG8xFzAVBg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lif1klZM
26
+ kt2XEtsgos5iSSLoPgPjVWtIXukwPfFqNyKLgMXYo++UE2RK3oqpQ5oOPw+nIl88
27
+ Choh3RQAYpipItGVLkZIV4kAj/eXwrzN/7XjZs8v8FxuPl1d1K0wi6gwQYzDZcUv
28
+ ZWMLj0l0fNwqsVIpG9851WaYDXxc2g8IYHwi+/Egq3P3rhgndt+sLI9hNG8xq+/W
29
+ QJyajKbJL+NTmHrfNqMqa3U8JTGyLsV3j+8hnb0uFpBndPIWxd4/swopQHMdMcsb
30
+ bnHreBY9jQe/A4TMZVk36eIoTmlL8ZvmfFjdai1hXwvXuIoX1GzjLQUq
31
31
  -----END CERTIFICATE-----
32
- date: 2013-11-07 00:00:00.000000000 Z
32
+ date: 2014-03-03 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rake
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  type: :development
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: bundler
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.3'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rspec
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.14.0
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 2.14.0
76
76
  description: Simple paginator
@@ -80,8 +80,8 @@ executables: []
80
80
  extensions: []
81
81
  extra_rdoc_files: []
82
82
  files:
83
- - .gitignore
84
- - .travis.yml
83
+ - ".gitignore"
84
+ - ".travis.yml"
85
85
  - Gemfile
86
86
  - LICENSE.txt
87
87
  - README.md
@@ -103,17 +103,17 @@ require_paths:
103
103
  - lib
104
104
  required_ruby_version: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - '>='
106
+ - - ">="
107
107
  - !ruby/object:Gem::Version
108
108
  version: 1.9.2
109
109
  required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
115
  rubyforge_project:
116
- rubygems_version: 2.1.3
116
+ rubygems_version: 2.2.2
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: Simple paginator
metadata.gz.sig CHANGED
Binary file