racknga 0.9.2 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -12
- data/README.textile +9 -8
- data/Rakefile +19 -272
- data/doc/text/news.textile +20 -0
- data/lib/racknga/access_log_parser.rb +147 -0
- data/lib/racknga/api-keys.rb +40 -0
- data/lib/racknga/cache_database.rb +15 -5
- data/lib/racknga/exception_mail_notifier.rb +6 -6
- data/lib/racknga/log_database.rb +2 -1
- data/lib/racknga/log_entry.rb +85 -0
- data/lib/racknga/middleware/auth/api-key.rb +95 -0
- data/lib/racknga/middleware/cache.rb +22 -8
- data/lib/racknga/middleware/deflater.rb +13 -3
- data/lib/racknga/middleware/exception_notifier.rb +1 -2
- data/lib/racknga/middleware/instance_name.rb +92 -9
- data/lib/racknga/middleware/jsonp.rb +25 -5
- data/lib/racknga/middleware/log.rb +8 -3
- data/lib/racknga/middleware/nginx_raw_uri.rb +65 -0
- data/lib/racknga/middleware/range.rb +1 -1
- data/lib/racknga/reverse_line_reader.rb +1 -1
- data/lib/racknga/utils.rb +1 -1
- data/lib/racknga/version.rb +2 -2
- data/lib/racknga.rb +4 -2
- data/munin/plugins/passenger_application_ +61 -47
- data/munin/plugins/passenger_status +64 -33
- data/test/racknga-test-utils.rb +2 -1
- data/test/run-test.rb +1 -3
- data/test/{test-nginx-log-parser.rb → test-access-log-parser.rb} +115 -26
- data/test/test-api-keys.rb +80 -0
- data/test/test-middleware-auth-api-key.rb +144 -0
- data/test/test-middleware-cache.rb +1 -1
- data/test/test-middleware-instance-name.rb +50 -16
- data/test/test-middleware-jsonp.rb +14 -2
- data/test/test-middleware-nginx-raw-uri.rb +70 -0
- data/test/test-middleware-range.rb +1 -1
- metadata +159 -155
- data/lib/racknga/nginx_access_log_parser.rb +0 -139
- data/lib/racknga/will_paginate.rb +0 -48
metadata
CHANGED
@@ -1,213 +1,217 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: racknga
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 9
|
9
|
-
- 2
|
10
|
-
version: 0.9.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.4
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Kouhei Sutou
|
14
|
-
autorequire:
|
8
|
+
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
-
none: false
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
hash: 3
|
27
|
-
segments:
|
28
|
-
- 0
|
29
|
-
version: "0"
|
30
|
-
name: rroonga
|
31
|
-
prerelease: false
|
32
|
-
type: :runtime
|
33
|
-
requirement: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
36
|
-
none: false
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
hash: 3
|
41
|
-
segments:
|
42
|
-
- 0
|
43
|
-
version: "0"
|
11
|
+
date: 2023-09-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
44
14
|
name: rack
|
45
|
-
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
46
20
|
type: :runtime
|
47
|
-
requirement: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
hash: 3
|
55
|
-
segments:
|
56
|
-
- 0
|
57
|
-
version: "0"
|
58
|
-
name: test-unit
|
59
21
|
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: RedCloth
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
60
34
|
type: :development
|
61
|
-
requirement: *id003
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
64
|
-
none: false
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
hash: 3
|
69
|
-
segments:
|
70
|
-
- 0
|
71
|
-
version: "0"
|
72
|
-
name: test-unit-notify
|
73
35
|
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
74
48
|
type: :development
|
75
|
-
requirement: *id004
|
76
|
-
- !ruby/object:Gem::Dependency
|
77
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
hash: 3
|
83
|
-
segments:
|
84
|
-
- 0
|
85
|
-
version: "0"
|
86
|
-
name: test-unit-capybara
|
87
49
|
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: packnga
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
88
62
|
type: :development
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
hash: 3
|
97
|
-
segments:
|
98
|
-
- 0
|
99
|
-
version: "0"
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
100
70
|
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rroonga
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
101
91
|
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: test-unit
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
102
104
|
type: :development
|
103
|
-
requirement: *id006
|
104
|
-
- !ruby/object:Gem::Dependency
|
105
|
-
version_requirements: &id007 !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
hash: 3
|
111
|
-
segments:
|
112
|
-
- 0
|
113
|
-
version: "0"
|
114
|
-
name: jeweler
|
115
105
|
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: test-unit-capybara
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
116
118
|
type: :development
|
117
|
-
requirement: *id007
|
118
|
-
- !ruby/object:Gem::Dependency
|
119
|
-
version_requirements: &id008 !ruby/object:Gem::Requirement
|
120
|
-
none: false
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
hash: 3
|
125
|
-
segments:
|
126
|
-
- 0
|
127
|
-
version: "0"
|
128
|
-
name: yard
|
129
119
|
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: test-unit-notify
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
130
132
|
type: :development
|
131
|
-
|
132
|
-
|
133
|
-
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Racknga is a Rack middlewares that uses Rroonga features.
|
140
|
+
email:
|
134
141
|
- kou@clear-code.com
|
135
142
|
executables: []
|
136
|
-
|
137
143
|
extensions: []
|
138
|
-
|
139
|
-
extra_rdoc_files:
|
144
|
+
extra_rdoc_files:
|
140
145
|
- README.textile
|
141
|
-
files:
|
146
|
+
files:
|
142
147
|
- AUTHORS
|
143
148
|
- Gemfile
|
144
149
|
- README.textile
|
145
150
|
- Rakefile
|
146
151
|
- doc/text//news.textile
|
147
152
|
- lib/racknga.rb
|
153
|
+
- lib/racknga/access_log_parser.rb
|
154
|
+
- lib/racknga/api-keys.rb
|
148
155
|
- lib/racknga/cache_database.rb
|
149
156
|
- lib/racknga/exception_mail_notifier.rb
|
150
157
|
- lib/racknga/log_database.rb
|
158
|
+
- lib/racknga/log_entry.rb
|
159
|
+
- lib/racknga/middleware/auth/api-key.rb
|
151
160
|
- lib/racknga/middleware/cache.rb
|
152
161
|
- lib/racknga/middleware/deflater.rb
|
153
162
|
- lib/racknga/middleware/exception_notifier.rb
|
154
163
|
- lib/racknga/middleware/instance_name.rb
|
155
164
|
- lib/racknga/middleware/jsonp.rb
|
156
165
|
- lib/racknga/middleware/log.rb
|
166
|
+
- lib/racknga/middleware/nginx_raw_uri.rb
|
157
167
|
- lib/racknga/middleware/range.rb
|
158
|
-
- lib/racknga/nginx_access_log_parser.rb
|
159
168
|
- lib/racknga/reverse_line_reader.rb
|
160
169
|
- lib/racknga/utils.rb
|
161
170
|
- lib/racknga/version.rb
|
162
|
-
- lib/racknga/will_paginate.rb
|
163
171
|
- license/lgpl-2.1.txt
|
164
172
|
- munin/plugins/passenger_application_
|
165
173
|
- munin/plugins/passenger_status
|
166
|
-
- test/test-middleware-jsonp.rb
|
167
174
|
- test/racknga-test-utils.rb
|
168
|
-
- test/test-middleware-range.rb
|
169
175
|
- test/run-test.rb
|
170
|
-
- test/test-
|
176
|
+
- test/test-access-log-parser.rb
|
177
|
+
- test/test-api-keys.rb
|
178
|
+
- test/test-middleware-auth-api-key.rb
|
171
179
|
- test/test-middleware-cache.rb
|
172
|
-
- test/test-
|
173
|
-
|
174
|
-
|
180
|
+
- test/test-middleware-instance-name.rb
|
181
|
+
- test/test-middleware-jsonp.rb
|
182
|
+
- test/test-middleware-nginx-raw-uri.rb
|
183
|
+
- test/test-middleware-range.rb
|
184
|
+
homepage: http://ranguba.org/
|
185
|
+
licenses:
|
175
186
|
- LGPLv2.1 or later
|
176
|
-
|
187
|
+
metadata: {}
|
188
|
+
post_install_message:
|
177
189
|
rdoc_options: []
|
178
|
-
|
179
|
-
require_paths:
|
190
|
+
require_paths:
|
180
191
|
- lib
|
181
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
-
|
183
|
-
requirements:
|
192
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
184
194
|
- - ">="
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
version: "0"
|
190
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
|
-
none: false
|
192
|
-
requirements:
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
197
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
193
199
|
- - ">="
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
|
196
|
-
segments:
|
197
|
-
- 0
|
198
|
-
version: "0"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
199
202
|
requirements: []
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
summary: A Rack middleware collection for rroonga features.
|
206
|
-
test_files:
|
207
|
-
- test/test-middleware-jsonp.rb
|
203
|
+
rubygems_version: 3.5.0.dev
|
204
|
+
signing_key:
|
205
|
+
specification_version: 4
|
206
|
+
summary: A Rack middleware collection for Rroonga features.
|
207
|
+
test_files:
|
208
208
|
- test/racknga-test-utils.rb
|
209
|
-
- test/test-middleware-range.rb
|
210
209
|
- test/run-test.rb
|
211
|
-
- test/test-
|
210
|
+
- test/test-access-log-parser.rb
|
211
|
+
- test/test-api-keys.rb
|
212
|
+
- test/test-middleware-auth-api-key.rb
|
212
213
|
- test/test-middleware-cache.rb
|
213
|
-
- test/test-
|
214
|
+
- test/test-middleware-instance-name.rb
|
215
|
+
- test/test-middleware-jsonp.rb
|
216
|
+
- test/test-middleware-nginx-raw-uri.rb
|
217
|
+
- test/test-middleware-range.rb
|
@@ -1,139 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Copyright (C) 2011 Ryo Onodera <onodera@clear-code.com>
|
4
|
-
#
|
5
|
-
# This library is free software; you can redistribute it and/or
|
6
|
-
# modify it under the terms of the GNU Lesser General Public
|
7
|
-
# License as published by the Free Software Foundation; either
|
8
|
-
# version 2.1 of the License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This library is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
-
# Lesser General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Lesser General Public
|
16
|
-
# License along with this library; if not, write to the Free Software
|
17
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18
|
-
|
19
|
-
require "racknga/reverse_line_reader"
|
20
|
-
|
21
|
-
module Racknga
|
22
|
-
# Supported formats:
|
23
|
-
# * combined (default format)
|
24
|
-
# * combined_with_time (custom format for Passenger)
|
25
|
-
#
|
26
|
-
# Configurations in nginx:
|
27
|
-
# * combined
|
28
|
-
# log_format combined '$remote_addr - $remote_user [$time_local] '
|
29
|
-
# '"$request" $status $body_bytes_sent '
|
30
|
-
# '"$http_referer" "$http_user_agent"';
|
31
|
-
# access_log log/access.log combined
|
32
|
-
#
|
33
|
-
# * combined_with_time
|
34
|
-
# log_format combined_with_time '$remote_addr - $remote_user '
|
35
|
-
# '[$time_local, $upstream_http_x_runtime, $request_time] '
|
36
|
-
# '"$request" $status $body_bytes_sent '
|
37
|
-
# '"$http_referer" "$http_user_agent"';
|
38
|
-
# access_log log/access.log combined_with_time
|
39
|
-
class NginxAccessLogParser
|
40
|
-
include Enumerable
|
41
|
-
|
42
|
-
class FormatError < StandardError
|
43
|
-
end
|
44
|
-
|
45
|
-
def initialize(line_reader)
|
46
|
-
@line_reader = line_reader
|
47
|
-
end
|
48
|
-
|
49
|
-
def each
|
50
|
-
@line_reader.each do |line|
|
51
|
-
line.force_encoding("UTF-8")
|
52
|
-
yield(parse_line(line)) if line.valid_encoding?
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
REMOTE_ADDRESS = '(?:\d{1,3}\.){3}\d{1,3}'
|
57
|
-
REMOTE_USER = '[^ ]+'
|
58
|
-
TIME_LOCAL = '[^ ]+ \+\d{4}'
|
59
|
-
RUNTIME = '(?:[\d.]+|-)'
|
60
|
-
REQUEST_TIME = '[\d.]+'
|
61
|
-
REQUEST = '.*?'
|
62
|
-
STATUS = '\d{3}'
|
63
|
-
BODY_BYTES_SENT = '\d+'
|
64
|
-
HTTP_REFERER = '.*?'
|
65
|
-
HTTP_USER_AGENT = '(?:\\"|[^\"])*?' # '
|
66
|
-
LOG_FORMAT =
|
67
|
-
/\A(#{REMOTE_ADDRESS}) - (#{REMOTE_USER}) \[(#{TIME_LOCAL})(?:, (#{RUNTIME}), (#{REQUEST_TIME}))?\] "(#{REQUEST})" (#{STATUS}) (#{BODY_BYTES_SENT}) "(#{HTTP_REFERER})" "(#{HTTP_USER_AGENT})"\n\z/
|
68
|
-
def parse_line(line)
|
69
|
-
if line =~ LOG_FORMAT
|
70
|
-
last_match = Regexp.last_match
|
71
|
-
options = {}
|
72
|
-
options[:remote_address] = last_match[1]
|
73
|
-
options[:remote_user] = last_match[2]
|
74
|
-
parse_time_local(last_match[3], options)
|
75
|
-
options[:runtime] = last_match[4].to_f
|
76
|
-
options[:request_time] = last_match[5].to_f
|
77
|
-
options[:request] = last_match[6]
|
78
|
-
options[:status] = last_match[7].to_i
|
79
|
-
options[:body_bytes_sent] = last_match[8].to_i
|
80
|
-
options[:http_referer] = last_match[9]
|
81
|
-
options[:http_user_agent] = last_match[10]
|
82
|
-
LogEntry.new(options)
|
83
|
-
else
|
84
|
-
raise FormatError.new("ill-formatted log entry: #{line.inspect} !~ #{LOG_FORMAT}")
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def parse_time_local(token, options)
|
89
|
-
day, month, year, hour, minute, second, _time_zone = token.split(/[\/: ]/)
|
90
|
-
options[:time_local] = Time.local(year, month, day, hour, minute, second)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
class ReversedNginxAccessLogParser < NginxAccessLogParser
|
95
|
-
def initialize(line_reader)
|
96
|
-
@line_reader = ReverseLineReader.new(line_reader)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
class LogEntry
|
101
|
-
ATTRIBUTES = [
|
102
|
-
:remote_address,
|
103
|
-
:remote_user,
|
104
|
-
:time_local,
|
105
|
-
:runtime,
|
106
|
-
:request_time,
|
107
|
-
:request,
|
108
|
-
:status,
|
109
|
-
:body_bytes_sent,
|
110
|
-
:http_referer,
|
111
|
-
:http_user_agent,
|
112
|
-
]
|
113
|
-
|
114
|
-
attr_reader(*ATTRIBUTES)
|
115
|
-
def initialize(options=nil)
|
116
|
-
options ||= {}
|
117
|
-
@remote_address = options[:remote_address]
|
118
|
-
@remote_user = options[:remote_user]
|
119
|
-
@time_local = options[:time_local] || Time.at(0)
|
120
|
-
@runtime = options[:runtime] || 0.0
|
121
|
-
@request_time = options[:request_time] || 0.0
|
122
|
-
@request = options[:request]
|
123
|
-
@status = options[:status]
|
124
|
-
@body_bytes_sent = options[:body_bytes_sent]
|
125
|
-
@http_referer = options[:http_referer]
|
126
|
-
@http_user_agent = options[:http_user_agent]
|
127
|
-
end
|
128
|
-
|
129
|
-
def attributes
|
130
|
-
ATTRIBUTES.collect do |attribute|
|
131
|
-
__send__(attribute)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def ==(other)
|
136
|
-
attributes == other.attributes
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Copyright (C) 2010 SHIMODA Hiroshi <shimoda@clear-code.com>
|
4
|
-
#
|
5
|
-
# This library is free software; you can redistribute it and/or
|
6
|
-
# modify it under the terms of the GNU Lesser General Public
|
7
|
-
# License as published by the Free Software Foundation; either
|
8
|
-
# version 2.1 of the License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This library is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
-
# Lesser General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Lesser General Public
|
16
|
-
# License along with this library; if not, write to the Free Software
|
17
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18
|
-
|
19
|
-
require "groonga"
|
20
|
-
|
21
|
-
module Groonga
|
22
|
-
# @deprecated since 0.9.2. Use Kaminari instead of will_paginate.
|
23
|
-
module WillPaginateAPI
|
24
|
-
def total_pages
|
25
|
-
n_pages
|
26
|
-
end
|
27
|
-
|
28
|
-
def per_page
|
29
|
-
n_records_in_page
|
30
|
-
end
|
31
|
-
|
32
|
-
def total_entries
|
33
|
-
n_records
|
34
|
-
end
|
35
|
-
|
36
|
-
def out_of_bounds?
|
37
|
-
current_page > total_pages
|
38
|
-
end
|
39
|
-
|
40
|
-
def offset
|
41
|
-
(start_offset || 0) - 1
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
module Pagination
|
46
|
-
include WillPaginateAPI
|
47
|
-
end
|
48
|
-
end
|