page_up 0.0.1 → 0.0.2

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: c5ad4acae0705e1d734bd9cdddcb60e282a29f91
4
- data.tar.gz: 26f1187a297d1a4d79e2fc2872e901934d6c1dfc
3
+ metadata.gz: f7345295fb84db01754653b39976ffaee5765a95
4
+ data.tar.gz: f783bdec5654e1c50d0825d1dfe69e7460ef7e4b
5
5
  SHA512:
6
- metadata.gz: 928945d37265bd686037eab1a417ffdd28b79e31af7b6a03544441dc2d4cc7114c703cf570185c6526d8f77ff2cc912e234667dcdd29c0c2409d0175d17d968c
7
- data.tar.gz: e84c3c0e80972f7bed16b7691b96c98725146ea5a9f2bd56b95c4e1c39f5be523a726965b1c6af9f3876d87dbe23ace1bab97fab2ea3a4ae3dc4dd683374e67a
6
+ metadata.gz: a07d4689de5c566761b81fd6b4131b7df3a9a4becf56403e7459f40176a84c35706beb5179e3c9688ba6bbacc78e8e2cdc6ce77def280f95896bbd7c452be02e
7
+ data.tar.gz: 473bf60755ba27ec468ce343e3f798725f89146a862139947fe347348f8661c5448d1749809d9a04c734202a61d541d2a8f9f0fc571ea3a1bb3793cfd55e4314
checksums.yaml.gz.sig CHANGED
Binary file
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - 1.9.2
6
+ - jruby-19mode
7
+ - rbx-19mode
8
+ matrix:
9
+ allow_failures:
10
+ - ruby-head
data/README.md CHANGED
@@ -1,6 +1,49 @@
1
1
  # PageUp
2
2
 
3
- TODO: Write a gem description
3
+ PageUp is a simple pagination gem, the idea being to use composition and
4
+ decoration of objects (rather than mixing into ActiveRecord) to divy up a
5
+ collection for pagination. This allows use with data sources other than ActiveRecord.
6
+
7
+ ## Usage
8
+
9
+ To create a paginated collection use the `PageUp[]` macro.
10
+
11
+ `page_up_pages = PageUp[ collection, page_number, number_per_page ]`
12
+
13
+ In addition to delegating all the original collection methods back to the
14
+ underling object, a page up collection allows:
15
+
16
+ Access to the total number of pages with `pages`
17
+
18
+ `page_up_pages.pages => 3`
19
+
20
+ Access to the supplied page number with `page` (defaults to 1)
21
+
22
+ `page_up_pages.page => 2`
23
+
24
+ Access to the supplied per page count with `per_page` (defaults to 25)
25
+
26
+ `page_up_pages.per_page => 25`
27
+
28
+ And provides a range indicating the current section of pages, this is intended
29
+ for integration with output views to indicate nearby page bookmarks and as
30
+ such returns the previous two and next two pages, but is bounded so that at the
31
+ start or end of a collection always returns 5... e.g:
32
+
33
+ ```
34
+ # page 2
35
+ page_up_pages.current_slice => 1..5
36
+
37
+ # page 7
38
+ page_up_pages.current_slice => 5..9
39
+
40
+ # page n-2
41
+ page_up_pages.current_slice => n-5..n
42
+ ```
43
+
44
+ ## ToDo
45
+
46
+ Extract helpers for integration with Rails and ORM libraries.
4
47
 
5
48
  ## Installation
6
49
 
@@ -16,10 +59,6 @@ Or install it yourself as:
16
59
 
17
60
  $ gem install page_up
18
61
 
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
62
  ## Contributing
24
63
 
25
64
  1. Fork it
data/Rakefile CHANGED
@@ -1 +1,12 @@
1
+ #!/usr/bin/env rake
1
2
  require "bundler/gem_tasks"
3
+
4
+ require 'rspec'
5
+ require 'rspec/core/rake_task'
6
+
7
+ desc "Run specs"
8
+ RSpec::Core::RakeTask.new :spec do |task|
9
+ task.pattern = 'spec/**/*_spec.rb'
10
+ end
11
+
12
+ task default: :spec
@@ -1,3 +1,3 @@
1
1
  module PageUp
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/page_up.gemspec CHANGED
@@ -6,7 +6,7 @@ require 'page_up/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "page_up"
8
8
  spec.version = PageUp::VERSION
9
- spec.required_ruby_version = ">= 1.9.3"
9
+ spec.required_ruby_version = ">= 1.9.2"
10
10
  spec.authors = ["Jon Rowe"]
11
11
  spec.email = ["hello@jonrowe.co.uk"]
12
12
  spec.description = %q{Simple paginator}
data.tar.gz.sig CHANGED
Binary file
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.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Rowe
@@ -29,7 +29,7 @@ cert_chain:
29
29
  2feWfO4gCNmvfFjULOAYHq9JHEjN5SLSXvj5HdSnDcCyIfJKn5Ya3JahWQaWIsXf
30
30
  /NPE/mB57TOwj+d7XUa2NC4HUadF8R51IYEcIB0PpIEzJlKtfXFcOZxO
31
31
  -----END CERTIFICATE-----
32
- date: 2013-07-01 00:00:00.000000000 Z
32
+ date: 2013-07-05 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rake
@@ -81,6 +81,7 @@ extensions: []
81
81
  extra_rdoc_files: []
82
82
  files:
83
83
  - .gitignore
84
+ - .travis.yml
84
85
  - Gemfile
85
86
  - LICENSE.txt
86
87
  - README.md
@@ -102,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
103
  requirements:
103
104
  - - '>='
104
105
  - !ruby/object:Gem::Version
105
- version: 1.9.3
106
+ version: 1.9.2
106
107
  required_rubygems_version: !ruby/object:Gem::Requirement
107
108
  requirements:
108
109
  - - '>='
metadata.gz.sig CHANGED
Binary file