peiji-san 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peiji-san
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 1
7
+ - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ segments_generated: true
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eloy Duran
@@ -15,11 +15,156 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-05 00:00:00 +02:00
18
+ date: 2012-01-23 00:00:00 +01:00
19
19
  default_executable:
20
- dependencies: []
21
-
22
- description: PeijiSan is a Rails plugin which uses named scopes to create a thin pagination layer.
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ segments:
27
+ - 0
28
+ segments_generated: true
29
+ version: "0"
30
+ requirement: *id001
31
+ name: minitest
32
+ prerelease: false
33
+ type: :development
34
+ - !ruby/object:Gem::Dependency
35
+ version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ segments_generated: true
42
+ version: "0"
43
+ requirement: *id002
44
+ name: mocha
45
+ prerelease: false
46
+ type: :development
47
+ - !ruby/object:Gem::Dependency
48
+ version_requirements: &id003 !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ segments:
53
+ - 0
54
+ segments_generated: true
55
+ version: "0"
56
+ requirement: *id003
57
+ name: rake
58
+ prerelease: false
59
+ type: :development
60
+ - !ruby/object:Gem::Dependency
61
+ version_requirements: &id004 !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ segments:
66
+ - 0
67
+ segments_generated: true
68
+ version: "0"
69
+ requirement: *id004
70
+ name: rack-test
71
+ prerelease: false
72
+ type: :development
73
+ - !ruby/object:Gem::Dependency
74
+ version_requirements: &id005 !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ segments:
79
+ - 0
80
+ segments_generated: true
81
+ version: "0"
82
+ requirement: *id005
83
+ name: rdoc
84
+ prerelease: false
85
+ type: :development
86
+ - !ruby/object:Gem::Dependency
87
+ version_requirements: &id006 !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ segments:
92
+ - 3
93
+ - 1
94
+ segments_generated: true
95
+ version: "3.1"
96
+ requirement: *id006
97
+ name: activesupport
98
+ prerelease: false
99
+ type: :development
100
+ - !ruby/object:Gem::Dependency
101
+ version_requirements: &id007 !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ segments:
106
+ - 3
107
+ - 1
108
+ segments_generated: true
109
+ version: "3.1"
110
+ requirement: *id007
111
+ name: activerecord
112
+ prerelease: false
113
+ type: :development
114
+ - !ruby/object:Gem::Dependency
115
+ version_requirements: &id008 !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ segments:
120
+ - 3
121
+ - 1
122
+ segments_generated: true
123
+ version: "3.1"
124
+ requirement: *id008
125
+ name: actionpack
126
+ prerelease: false
127
+ type: :development
128
+ - !ruby/object:Gem::Dependency
129
+ version_requirements: &id009 !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ segments:
134
+ - 0
135
+ segments_generated: true
136
+ version: "0"
137
+ requirement: *id009
138
+ name: sqlite3
139
+ prerelease: false
140
+ type: :development
141
+ - !ruby/object:Gem::Dependency
142
+ version_requirements: &id010 !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ segments:
147
+ - 0
148
+ segments_generated: true
149
+ version: "0"
150
+ requirement: *id010
151
+ name: sinatra
152
+ prerelease: false
153
+ type: :development
154
+ - !ruby/object:Gem::Dependency
155
+ version_requirements: &id011 !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ segments:
160
+ - 0
161
+ segments_generated: true
162
+ version: "0"
163
+ requirement: *id011
164
+ name: tobias-sinatra-url-for
165
+ prerelease: false
166
+ type: :development
167
+ description:
23
168
  email: eloy.de.enige@gmail.com
24
169
  executables: []
25
170
 
@@ -28,31 +173,15 @@ extensions: []
28
173
  extra_rdoc_files:
29
174
  - LICENSE
30
175
  - README.rdoc
31
- - TODO
32
176
  files:
33
177
  - LICENSE
34
178
  - README.rdoc
35
179
  - Rakefile
36
- - TODO
37
- - VERSION.yml
38
180
  - init.rb
39
181
  - lib/peiji_san.rb
40
182
  - lib/peiji_san/view_helper.rb
41
- - peiji-san.gemspec
42
- - rdoc/classes/PeijiSan.html
43
- - rdoc/classes/PeijiSan/PaginationMethods.html
44
- - rdoc/classes/PeijiSan/ViewHelper.html
45
- - rdoc/created.rid
46
- - rdoc/files/LICENSE.html
47
- - rdoc/files/README_rdoc.html
48
- - rdoc/files/lib/peiji_san/view_helper_rb.html
49
- - rdoc/files/lib/peiji_san_rb.html
50
- - rdoc/fr_class_index.html
51
- - rdoc/fr_file_index.html
52
- - rdoc/fr_method_index.html
53
- - rdoc/index.html
54
- - rdoc/rdoc-style.css
55
183
  - test/peiji_san_test.rb
184
+ - test/sinatra_test.rb
56
185
  - test/test_helper.rb
57
186
  - test/view_helper_test.rb
58
187
  has_rdoc: true
@@ -65,31 +194,27 @@ rdoc_options: []
65
194
  require_paths:
66
195
  - lib
67
196
  required_ruby_version: !ruby/object:Gem::Requirement
68
- none: false
69
197
  requirements:
70
198
  - - ">="
71
199
  - !ruby/object:Gem::Version
72
- hash: 3
73
200
  segments:
74
201
  - 0
202
+ segments_generated: true
75
203
  version: "0"
76
204
  required_rubygems_version: !ruby/object:Gem::Requirement
77
- none: false
78
205
  requirements:
79
206
  - - ">="
80
207
  - !ruby/object:Gem::Version
81
- hash: 3
82
208
  segments:
83
209
  - 0
210
+ segments_generated: true
84
211
  version: "0"
85
212
  requirements: []
86
213
 
87
214
  rubyforge_project:
88
- rubygems_version: 1.5.2
215
+ rubygems_version: 1.3.6
89
216
  signing_key:
90
217
  specification_version: 3
91
218
  summary: PeijiSan is a Rails plugin which uses named scopes to create a thin pagination layer.
92
- test_files:
93
- - test/peiji_san_test.rb
94
- - test/test_helper.rb
95
- - test/view_helper_test.rb
219
+ test_files: []
220
+
data/TODO DELETED
@@ -1 +0,0 @@
1
- * Make it possible to use this pattern: http://www.percona.com/ppc2009/PPC2009_mysql_pagination.pdf
data/VERSION.yml DELETED
@@ -1,5 +0,0 @@
1
- ---
2
- :patch: 0
3
- :major: 1
4
- :build:
5
- :minor: 0
data/peiji-san.gemspec DELETED
@@ -1,30 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{peiji-san}
5
- s.version = "0.1.1"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Eloy Duran"]
9
- s.date = %q{2009-03-09}
10
- s.description = %q{PeijiSan is a Rails plugin which uses named scopes to create a thin pagination layer.}
11
- s.email = %q{eloy.de.enige@gmail.com}
12
- s.extra_rdoc_files = ["README.rdoc", "LICENSE"]
13
- s.files = ["lib", "lib/peiji_san", "lib/peiji_san/view_helper.rb", "lib/peiji_san.rb", "LICENSE", "peiji-san.gemspec", "rails", "rails/init.rb", "Rakefile", "README.rdoc", "test", "test/peiji_san_test.rb", "test/test_helper.rb", "test/view_helper_test.rb", "VERSION.yml"]
14
- s.has_rdoc = true
15
- s.homepage = %q{http://github.com/Fingertips/peiji-san}
16
- s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
17
- s.require_paths = ["lib"]
18
- s.rubygems_version = %q{1.3.1}
19
- s.summary = %q{PeijiSan is a Rails plugin which uses named scopes to create a thin pagination layer.}
20
-
21
- if s.respond_to? :specification_version then
22
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
- s.specification_version = 2
24
-
25
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
- else
27
- end
28
- else
29
- end
30
- end
@@ -1,306 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Module: PeijiSan</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Module</strong></td>
53
- <td class="class-name-in-header">PeijiSan</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/peiji_san/view_helper_rb.html">
59
- lib/peiji_san/view_helper.rb
60
- </a>
61
- <br />
62
- <a href="../files/lib/peiji_san_rb.html">
63
- lib/peiji_san.rb
64
- </a>
65
- <br />
66
- </td>
67
- </tr>
68
-
69
- </table>
70
- </div>
71
- <!-- banner header -->
72
-
73
- <div id="bodyContent">
74
-
75
-
76
-
77
- <div id="contextContent">
78
-
79
- <div id="description">
80
- <p>
81
- Peiji-San uses named scopes to create a thin pagination layer.
82
- </p>
83
- <p>
84
- Example:
85
- </p>
86
- <pre>
87
- class Member &lt; ActiveRecord::Base
88
- extend PeijiSan
89
- self.entries_per_page = 32
90
- end
91
- </pre>
92
- <p>
93
- Now you can start scoping your queries by `<a
94
- href="PeijiSan.html#M000003">page</a>&#8217;:
95
- </p>
96
- <pre>
97
- Member.active.page(2)
98
- </pre>
99
- <p>
100
- Which will return 32 records with an offset of 32, as that&#8216;s the
101
- second <a href="PeijiSan.html#M000003">page</a>.
102
- </p>
103
- <p>
104
- See <a
105
- href="PeijiSan/PaginationMethods.html">PeijiSan::PaginationMethods</a> and
106
- <a href="PeijiSan/ViewHelper.html">PeijiSan::ViewHelper</a> for more info.
107
- </p>
108
-
109
- </div>
110
-
111
-
112
- </div>
113
-
114
- <div id="method-list">
115
- <h3 class="section-bar">Methods</h3>
116
-
117
- <div class="name-list">
118
- <a href="#M000002">entries_per_page</a>&nbsp;&nbsp;
119
- <a href="#M000001">entries_per_page=</a>&nbsp;&nbsp;
120
- <a href="#M000003">page</a>&nbsp;&nbsp;
121
- </div>
122
- </div>
123
-
124
- </div>
125
-
126
-
127
- <!-- if includes -->
128
-
129
- <div id="section">
130
-
131
- <div id="class-list">
132
- <h3 class="section-bar">Classes and Modules</h3>
133
-
134
- Module <a href="PeijiSan/PaginationMethods.html" class="link">PeijiSan::PaginationMethods</a><br />
135
- Module <a href="PeijiSan/ViewHelper.html" class="link">PeijiSan::ViewHelper</a><br />
136
-
137
- </div>
138
-
139
- <div id="constants-list">
140
- <h3 class="section-bar">Constants</h3>
141
-
142
- <div class="name-list">
143
- <table summary="Constants">
144
- <tr class="top-aligned-row context-row">
145
- <td class="context-item-name">ENTRIES_PER_PAGE</td>
146
- <td>=</td>
147
- <td class="context-item-value">32</td>
148
- </tr>
149
- </table>
150
- </div>
151
- </div>
152
-
153
-
154
-
155
-
156
-
157
-
158
- <!-- if method_list -->
159
- <div id="methods">
160
- <h3 class="section-bar">Public Instance methods</h3>
161
-
162
- <div id="method-M000002" class="method-detail">
163
- <a name="M000002"></a>
164
-
165
- <div class="method-heading">
166
- <a href="#M000002" class="method-signature">
167
- <span class="method-name">entries_per_page</span><span class="method-args">()</span>
168
- </a>
169
- </div>
170
-
171
- <div class="method-description">
172
- <p>
173
- Returns the number of entries you want per <a
174
- href="PeijiSan.html#M000003">page</a>.
175
- </p>
176
- <pre>
177
- class Member &lt; ActiveRecord::Base
178
- extend PeijiSan
179
- self.entries_per_page = 32
180
- end
181
- Member.entries_per_page #=&gt; 32
182
- </pre>
183
- <p><a class="source-toggle" href="#"
184
- onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
185
- <div class="method-source-code" id="M000002-source">
186
- <pre>
187
- <span class="ruby-comment cmt"># File lib/peiji_san.rb, line 85</span>
188
- 85: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">entries_per_page</span>
189
- 86: <span class="ruby-ivar">@entries_per_page</span>
190
- 87: <span class="ruby-keyword kw">end</span>
191
- </pre>
192
- </div>
193
- </div>
194
- </div>
195
-
196
- <div id="method-M000001" class="method-detail">
197
- <a name="M000001"></a>
198
-
199
- <div class="method-heading">
200
- <a href="#M000001" class="method-signature">
201
- <span class="method-name">entries_per_page=</span><span class="method-args">(entries)</span>
202
- </a>
203
- </div>
204
-
205
- <div class="method-description">
206
- <p>
207
- Sets the number of entries you want per <a
208
- href="PeijiSan.html#M000003">page</a>.
209
- </p>
210
- <pre>
211
- class Member &lt; ActiveRecord::Base
212
- extend PeijiSan
213
- self.entries_per_page = 32
214
- end
215
- </pre>
216
- <p><a class="source-toggle" href="#"
217
- onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
218
- <div class="method-source-code" id="M000001-source">
219
- <pre>
220
- <span class="ruby-comment cmt"># File lib/peiji_san.rb, line 74</span>
221
- 74: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">entries_per_page=</span>(<span class="ruby-identifier">entries</span>)
222
- 75: <span class="ruby-ivar">@entries_per_page</span> = <span class="ruby-identifier">entries</span>
223
- 76: <span class="ruby-keyword kw">end</span>
224
- </pre>
225
- </div>
226
- </div>
227
- </div>
228
-
229
- <div id="method-M000003" class="method-detail">
230
- <a name="M000003"></a>
231
-
232
- <div class="method-heading">
233
- <a href="#M000003" class="method-signature">
234
- <span class="method-name">page</span><span class="method-args">(page, entries_per_page=nil)</span>
235
- </a>
236
- </div>
237
-
238
- <div class="method-description">
239
- <p>
240
- Set the current scope to a given <a href="PeijiSan.html#M000003">page</a>
241
- number.
242
- </p>
243
- <p>
244
- Consider:
245
- </p>
246
- <pre>
247
- class Member &lt; ActiveRecord::Base
248
- extend PeijiSan
249
- self.entries_per_page = 32
250
- end
251
- </pre>
252
- <p>
253
- This adds <tt>{ :limit =&gt; 32, :offset =&gt; 0 }</tt> to the scope:
254
- </p>
255
- <pre>
256
- Member.page(1)
257
- </pre>
258
- <p>
259
- This adds <tt>{ :limit =&gt; 32, :offset =&gt; 31 }</tt> to the scope:
260
- </p>
261
- <pre>
262
- Member.page(2)
263
- </pre>
264
- <p>
265
- You can optionally override the <a
266
- href="PeijiSan.html#M000002">entries_per_page</a> setting by sepcifying a
267
- second argument:
268
- </p>
269
- <pre>
270
- Member.page(2, 5) # Page 2, 5 entries
271
- </pre>
272
- <p><a class="source-toggle" href="#"
273
- onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
274
- <div class="method-source-code" id="M000003-source">
275
- <pre>
276
- <span class="ruby-comment cmt"># File lib/peiji_san.rb, line 110</span>
277
- 110: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">page</span>(<span class="ruby-identifier">page</span>, <span class="ruby-identifier">entries_per_page</span>=<span class="ruby-keyword kw">nil</span>)
278
- 111: <span class="ruby-identifier">page</span> = <span class="ruby-identifier">page</span>.<span class="ruby-identifier">blank?</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">page</span>.<span class="ruby-identifier">to_i</span>
279
- 112: <span class="ruby-identifier">entries_per_page</span> = <span class="ruby-identifier">entries_per_page</span> <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">entries_per_page</span> <span class="ruby-operator">||</span> <span class="ruby-constant">ENTRIES_PER_PAGE</span>
280
- 113:
281
- 114: <span class="ruby-identifier">entries</span> = <span class="ruby-identifier">scoped</span>
282
- 115: <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">PeijiSan</span><span class="ruby-operator">::</span><span class="ruby-constant">PaginationMethods</span>)
283
- 116: <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">current_page</span> = <span class="ruby-identifier">page</span>
284
- 117: <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">entries_per_page</span> = <span class="ruby-identifier">entries_per_page</span>
285
- 118: <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">scope_without_pagination</span> = <span class="ruby-identifier">scoped</span>
286
- 119:
287
- 120: <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">limit</span>(<span class="ruby-identifier">entries_per_page</span>).<span class="ruby-identifier">offset</span>((<span class="ruby-identifier">page</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-operator">*</span> <span class="ruby-identifier">entries_per_page</span>)
288
- 121: <span class="ruby-keyword kw">end</span>
289
- </pre>
290
- </div>
291
- </div>
292
- </div>
293
-
294
-
295
- </div>
296
-
297
-
298
- </div>
299
-
300
-
301
- <div id="validator-badges">
302
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
303
- </div>
304
-
305
- </body>
306
- </html>