Skip to content
Browse files

version bump and convert old rdoc README to markdown README.md

  • Loading branch information...
1 parent 8ec01df commit 820aa7b14f0d6d271d78488d9b365fcd32724c31 @godfat committed
Showing with 158 additions and 153 deletions.
  1. +0 −152 README
  2. +157 −0 README.md
  3. +1 −1 lib/pagify/version.rb
View
152 README
@@ -1,152 +0,0 @@
-= pagify 0.7.1
-by Lin Jen-Shin (godfat[http://godfat.org])
- godfat (XD) godfat.org
-
-== LINKS:
-
-* github-project[https://github.com/godfat/pagify]
-* rubyforge-project[http://rubyforge.org/projects/ludy]
-
-== DESCRIPTION:
-
- Pagination tools for Array(or custom class), DataMapper and ActiveRecord
- Helpers for Innate/Ramaze and Rails included.
-
-== FEATURES:
-
-* Aims to be as flexible as possible
-* Separate intrusive "pagify" method and Array/DataMapper/ActiveRecord Pager.
-* Separate view helpers. There's only html helper right now.
-* Web framework specific helper included. Currently for Innate/Ramaze and Rails.
-
-== SYNOPSIS:
-
- # for fast Rails will_paginate replacement:
- require 'pagify/active_record'
- require 'pagify/helper/rails'
-
- # in controller:
- @photos = Photo.pagify(:page => params[:page])
-
- # in view:
- pagify_links(@photos)
-
-
-
- # for Innate/Ramaze:
- require 'pagify'
- require 'pagify/helper/innate'
-
- # in controller, say you want pagify helper:
- class Controller < Ramaze::Controller
- helper :pagify
- end
-
- # for the data part, see DataMapperPager or ActiveRecordPager
- # in view, same as in Rails
-
-
-
- # basic DataMapper usage:
- require 'pagify/data_mapper'
-
- class User
- include DataMapper::Resource
- property :id, Serial
- property :name, String
- has n, :pets
- end
-
- class Pet
- include DataMapper::Resource
- property :id, Serial
- property :name, String
- belongs_to :user
- end
-
- User.pagify :page => 1, :per_page => 10 # => create a page contains users
- User.all(:name => 'godfat').pagify # => create a page contains users named godfat
-
- User.get(1).pets.pagify # => create a page contains pets owned by user 1
-
-
-
- # basic html helper usage:
- require 'pagify/helper/html'
-
- # create a string with page links.
- Pet.pagify.pager.html.links(params[:page]){ |page|
- # the block result would be used as url for each page
- "/pets/list?page=#{page}"
- }
-
- Pagify::Helper::HTML.setting[:prev_text] = '<]' # globally change html setting
- # NOTE: if you would like to use instance level setting, you shouldn't use method pagify,
- # NOTE: new your own DataMapperPager or so to remember instance level html setting.
- # NOTE: for example, see below:
-
- class Pet
- # same as above
- def self.page num
- @pager ||= begin
- pager = Pagify::DataMapperPager.new(:per_page => 20)
- # below would be pager instance level setting
- # you can setup global setting mentioned above in your init script perhaps
- pager.html.setting[:separator] = ' . '
- pager.html.setting[:ellipsis] = '...'
- pager
- end
- @pager.page(num)
- end
- end
-
- # then you would use Pet.page(3) or user.pets.page(2) to retrieve data
-
- # this would create next/prev links only.
- Pet.page(1).html.links_navigate{ |page|
- "/pets/list?page=#{page}"
- }
-
- # this would create next/prev links and other page links
- pet_pager.page(1).html.links_full{ |page|
- "/pets/show?page=#{page}"
- }
-
- # and you can build your pager from scratch via BasicPager.
- # e.g. BasicPager.new :fetcher => lambda{|*a|[]}, :counter => lambda{0}
- # this would be similar to Pagify::NullPager.
-
- # you can disable null page via passing :null_page => false to any pager,
- # or set pager.null_page = false; anytime.
-
- # see example or test for more examples (and use case for ActiveRecordPager).
-
-== REQUIREMENTS:
-
-* ruby 1.8+ or 1.9.1+
-* for Basic/ArrayPager: only ruby is needed
-* for DataMapperPager: dm-core and dm-aggregates 0.10.1+
-* for ActiveRecordPager: activerecord 2.3.4+
-* for Innate helper: innate 2009.07+
-
-== INSTALL:
-
-* gem install pagify
-
-== LICENSE:
-
-Apache License 2.0
-
-Copyright (c) 2008-2009, Lin Jen-Shin (aka godfat 真常)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
View
157 README.md
@@ -0,0 +1,157 @@
+# pagify
+
+by Lin Jen-Shin ([godfat](http://godfat.org))
+
+## LINKS:
+
+* [github](https://github.com/godfat/pagify)
+* [rubygems](http://rubygems.org/gems/pagify)
+* [rdoc](http://rdoc.info/github/godfat/pagify)
+
+## DESCRIPTION:
+
+Pagination tools for Array(or custom class), DataMapper and ActiveRecord.
+Helpers for Innate/Ramaze and Rails included.
+
+## REQUIREMENTS:
+
+* Ruby 1.8+ or 1.9.1+
+* For Basic/ArrayPager: only Ruby is needed
+* For DataMapperPager: dm-core and dm-aggregates 1.2+
+* for ActiveRecordPager: activerecord 2.3.14+ or activerecord 3.1+
+* for Innate helper: innate 2011.10+
+
+## INSTALLATION:
+
+ gem install pagify
+
+## FEATURES:
+
+* Aims to be as flexible as possible
+* Separate intrusive "pagify" method and Array/DataMapper/ActiveRecord Pager.
+* Separate view helpers. There's only html helper right now.
+* Web framework specific helper included. Currently for Innate/Ramaze and Rails.
+
+## SYNOPSIS:
+
+For fast Rails will_paginate replacement:
+
+ require 'pagify/active_record'
+ require 'pagify/helper/rails'
+
+in controller:
+
+ @photos = Photo.pagify(:page => params[:page])
+
+in view:
+
+ pagify_links(@photos)
+
+For Innate/Ramaze:
+
+ require 'pagify'
+ require 'pagify/helper/innate'
+
+in controller, say you want pagify helper:
+
+ class Controller < Ramaze::Controller
+ helper :pagify
+ end
+
+for the data part, see `DataMapperPager` or `ActiveRecordPager` in view,
+same as in Rails.
+
+Basic DataMapper usage:
+
+ require 'pagify/data_mapper'
+
+ class User
+ include DataMapper::Resource
+ property :id, Serial
+ property :name, String
+ has n, :pets
+ end
+
+ class Pet
+ include DataMapper::Resource
+ property :id, Serial
+ property :name, String
+ belongs_to :user
+ end
+
+ User.pagify :page => 1, :per_page => 10 # => create a page contains users
+ User.all(:name => 'godfat').pagify # => create a page contains users named godfat
+
+ User.get(1).pets.pagify # => create a page contains pets owned by user 1
+
+Basic html helper usage:
+
+ require 'pagify/helper/html'
+
+Create a string with page links.
+
+ Pet.pagify.pager.html.links(params[:page]){ |page|
+ # the block result would be used as url for each page
+ "/pets/list?page=#{page}"
+ }
+
+ Pagify::Helper::HTML.setting[:prev_text] = '<]' # globally change html setting
+
+If you would like to use instance level setting, you shouldn't use method
+pagify, new your own DataMapperPager or so to remember instance level html
+setting. for example, see below:
+
+ class Pet
+ # same as above
+ def self.page num
+ @pager ||= begin
+ pager = Pagify::DataMapperPager.new(:per_page => 20)
+ # below would be pager instance level setting
+ # you can setup global setting mentioned above in your init script perhaps
+ pager.html.setting[:separator] = ' . '
+ pager.html.setting[:ellipsis] = '...'
+ pager
+ end
+ @pager.page(num)
+ end
+ end
+
+Then you would use `Pet.page(3)` or `user.pets.page(2)` to retrieve data.
+This would create next/prev links only.
+
+ Pet.page(1).html.links_navigate{ |page|
+ "/pets/list?page=#{page}"
+ }
+
+This would create next/prev links and other page links
+
+ pet_pager.page(1).html.links_full{ |page|
+ "/pets/show?page=#{page}"
+ }
+
+and you can build your pager from scratch via BasicPager.
+e.g. `BasicPager.new :fetcher => lambda{|*a|[]}, :counter => lambda{0}`
+this would be similar to `Pagify::NullPager`.
+
+You can disable null page via passing `:null_page => false` to any pager,
+or set `pager.null_page = false` anytime.
+
+See example or test for more examples (and use case for `ActiveRecordPager`).
+
+## LICENSE:
+
+Apache License 2.0
+
+Copyright (c) 2008-2011, Lin Jen-Shin (godfat)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
View
2 lib/pagify/version.rb
@@ -1,4 +1,4 @@
module Pagify
- VERSION = '0.7.1'
+ VERSION = '0.8.0'
end

0 comments on commit 820aa7b

Please sign in to comment.
Something went wrong with that request. Please try again.