merb-core 0.9.13 → 1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. data/Rakefile +5 -3
  2. data/lib/merb-core.rb +84 -41
  3. data/lib/merb-core/bootloader.rb +71 -60
  4. data/lib/merb-core/config.rb +31 -17
  5. data/lib/merb-core/controller/abstract_controller.rb +35 -35
  6. data/lib/merb-core/controller/exceptions.rb +14 -9
  7. data/lib/merb-core/controller/merb_controller.rb +22 -20
  8. data/lib/merb-core/controller/mime.rb +5 -5
  9. data/lib/merb-core/controller/mixins/authentication.rb +11 -8
  10. data/lib/merb-core/controller/mixins/conditional_get.rb +7 -7
  11. data/lib/merb-core/controller/mixins/controller.rb +15 -15
  12. data/lib/merb-core/controller/mixins/render.rb +16 -16
  13. data/lib/merb-core/controller/mixins/responder.rb +23 -23
  14. data/lib/merb-core/controller/template.rb +17 -17
  15. data/lib/merb-core/core_ext/hash.rb +2 -2
  16. data/lib/merb-core/core_ext/kernel.rb +19 -18
  17. data/lib/merb-core/dispatch/cookies.rb +13 -0
  18. data/lib/merb-core/dispatch/default_exception/default_exception.rb +12 -1
  19. data/lib/merb-core/dispatch/dispatcher.rb +6 -5
  20. data/lib/merb-core/dispatch/request.rb +56 -52
  21. data/lib/merb-core/dispatch/request_parsers.rb +7 -7
  22. data/lib/merb-core/dispatch/router.rb +14 -14
  23. data/lib/merb-core/dispatch/router/behavior.rb +31 -31
  24. data/lib/merb-core/dispatch/router/cached_proc.rb +13 -1
  25. data/lib/merb-core/dispatch/router/resources.rb +9 -9
  26. data/lib/merb-core/dispatch/router/route.rb +60 -7
  27. data/lib/merb-core/dispatch/session.rb +21 -15
  28. data/lib/merb-core/dispatch/session/container.rb +10 -8
  29. data/lib/merb-core/dispatch/session/cookie.rb +12 -11
  30. data/lib/merb-core/dispatch/session/memcached.rb +4 -2
  31. data/lib/merb-core/dispatch/session/memory.rb +8 -6
  32. data/lib/merb-core/dispatch/session/store_container.rb +6 -5
  33. data/lib/merb-core/dispatch/worker.rb +28 -10
  34. data/lib/merb-core/gem_ext/erubis.rb +4 -2
  35. data/lib/merb-core/logger.rb +3 -22
  36. data/lib/merb-core/plugins.rb +5 -5
  37. data/lib/merb-core/rack.rb +1 -1
  38. data/lib/merb-core/rack/adapter.rb +5 -1
  39. data/lib/merb-core/rack/adapter/abstract.rb +15 -10
  40. data/lib/merb-core/rack/adapter/ebb.rb +4 -2
  41. data/lib/merb-core/rack/adapter/evented_mongrel.rb +2 -1
  42. data/lib/merb-core/rack/adapter/fcgi.rb +3 -1
  43. data/lib/merb-core/rack/adapter/irb.rb +10 -1
  44. data/lib/merb-core/rack/adapter/mongrel.rb +5 -2
  45. data/lib/merb-core/rack/adapter/runner.rb +3 -1
  46. data/lib/merb-core/rack/adapter/swiftiplied_mongrel.rb +2 -1
  47. data/lib/merb-core/rack/adapter/thin.rb +4 -1
  48. data/lib/merb-core/rack/adapter/thin_turbo.rb +1 -0
  49. data/lib/merb-core/rack/adapter/webrick.rb +8 -34
  50. data/lib/merb-core/rack/application.rb +2 -2
  51. data/lib/merb-core/rack/handler/mongrel.rb +7 -0
  52. data/lib/merb-core/rack/helpers.rb +1 -1
  53. data/lib/merb-core/rack/middleware.rb +7 -1
  54. data/lib/merb-core/rack/middleware/conditional_get.rb +3 -0
  55. data/lib/merb-core/rack/middleware/content_length.rb +2 -0
  56. data/lib/merb-core/rack/middleware/path_prefix.rb +4 -0
  57. data/lib/merb-core/rack/middleware/profiler.rb +3 -1
  58. data/lib/merb-core/rack/middleware/static.rb +7 -1
  59. data/lib/merb-core/rack/middleware/tracer.rb +1 -0
  60. data/lib/merb-core/rack/stream_wrapper.rb +35 -30
  61. data/lib/merb-core/server.rb +17 -16
  62. data/lib/merb-core/tasks/gem_management.rb +1 -1
  63. data/lib/merb-core/tasks/merb.rb +3 -1
  64. data/lib/merb-core/tasks/merb_rake_helper.rb +1 -1
  65. data/lib/merb-core/test.rb +8 -8
  66. data/lib/merb-core/test/helpers.rb +1 -1
  67. data/lib/merb-core/test/helpers/cookie_jar.rb +16 -2
  68. data/lib/merb-core/test/helpers/mock_request_helper.rb +13 -13
  69. data/lib/merb-core/test/helpers/request_helper.rb +1 -1
  70. data/lib/merb-core/test/helpers/route_helper.rb +2 -2
  71. data/lib/merb-core/test/matchers.rb +3 -3
  72. data/lib/merb-core/test/matchers/request_matchers.rb +1 -1
  73. data/lib/merb-core/test/run_spec.rb +1 -1
  74. data/lib/merb-core/test/tasks/spectasks.rb +1 -1
  75. data/lib/merb-core/test/test_ext/hpricot.rb +1 -1
  76. data/lib/merb-core/test/test_ext/rspec.rb +2 -2
  77. data/lib/merb-core/test/test_ext/string.rb +1 -1
  78. data/lib/merb-core/version.rb +1 -1
  79. metadata +8 -22
  80. data/lib/merb-core/test/matchers/view_matchers.rb +0 -231
  81. data/lib/merb-core/test/webrat.rb +0 -37
  82. data/lib/merb-core/vendor/nokogiri/css.rb +0 -6
  83. data/lib/merb-core/vendor/nokogiri/css/generated_parser.rb +0 -653
  84. data/lib/merb-core/vendor/nokogiri/css/generated_tokenizer.rb +0 -159
  85. data/lib/merb-core/vendor/nokogiri/css/node.rb +0 -95
  86. data/lib/merb-core/vendor/nokogiri/css/parser.rb +0 -24
  87. data/lib/merb-core/vendor/nokogiri/css/parser.y +0 -198
  88. data/lib/merb-core/vendor/nokogiri/css/tokenizer.rb +0 -9
  89. data/lib/merb-core/vendor/nokogiri/css/tokenizer.rex +0 -63
  90. data/lib/merb-core/vendor/nokogiri/css/xpath_visitor.rb +0 -159
@@ -7,10 +7,10 @@ class Hash
7
7
  # ==== Returns
8
8
  # Array[Object]:: The values of the provided arguments in corresponding order.
9
9
  #
10
- # @api public
10
+ # :api: public
11
11
  def extract!(*args)
12
12
  args.map do |arg|
13
13
  self.delete(arg)
14
14
  end
15
15
  end
16
- end
16
+ end
@@ -2,6 +2,7 @@ require 'rubygems/dependency'
2
2
 
3
3
  module Gem
4
4
  class Dependency
5
+ # :api: private
5
6
  attr_accessor :require_block, :require_as
6
7
  end
7
8
  end
@@ -16,7 +17,7 @@ module Kernel
16
17
  #
17
18
  # @return <Gem::Dependency> Dependency information
18
19
  #
19
- # @api private
20
+ # :api: private
20
21
  def track_dependency(name, *ver, &blk)
21
22
  options = ver.pop if ver.last.is_a?(Hash)
22
23
  new_dep = Gem::Dependency.new(name, ver.empty? ? nil : ver)
@@ -51,7 +52,7 @@ module Kernel
51
52
  # ==== Returns
52
53
  # Gem::Dependency:: The dependency information.
53
54
  #
54
- # @api public
55
+ # :api: public
55
56
  def dependency(name, *ver, &blk)
56
57
  immediate = ver.last.delete(:immediate) if ver.last.is_a?(Hash)
57
58
  if immediate || Merb::BootLoader.finished?(Merb::BootLoader::Dependencies)
@@ -78,7 +79,7 @@ module Kernel
78
79
  #
79
80
  # @return <Gem::Dependency> The dependency information.
80
81
  #
81
- # @api private
82
+ # :api: private
82
83
  def load_dependency(name, *ver, &blk)
83
84
  dep = name.is_a?(Gem::Dependency) ? name : track_dependency(name, *ver, &blk)
84
85
  gem(dep)
@@ -109,7 +110,7 @@ module Kernel
109
110
  # Array[(Gem::Dependency, Array[Gem::Dependency])]:: Gem::Dependencies for the
110
111
  # dependencies specified in args.
111
112
  #
112
- # @api public
113
+ # :api: public
113
114
  def dependencies(*args)
114
115
  args.map do |arg|
115
116
  case arg
@@ -135,7 +136,7 @@ module Kernel
135
136
  # @example dependencies "RedCloth", "merb_helpers" # Loads RedCloth and merb_helpers
136
137
  # @example dependencies "RedCloth" => "3.0" # Loads RedCloth 3.0
137
138
  #
138
- # @api private
139
+ # :api: private
139
140
  def load_dependencies(*args)
140
141
  args.map do |arg|
141
142
  case arg
@@ -151,7 +152,7 @@ module Kernel
151
152
  # @param library<to_s> The library to attempt to include.
152
153
  # @param message<String> The error to add to the log upon failure. Defaults to nil.
153
154
  #
154
- # @api private
155
+ # :api: private
155
156
  # @deprecated
156
157
  def rescue_require(library, message = nil)
157
158
  Merb.logger.warn("Deprecation warning: rescue_require is deprecated")
@@ -181,12 +182,12 @@ module Kernel
181
182
  # If for some reason this is called more than once, latter
182
183
  # call takes over other.
183
184
  #
184
- # @api public
185
- def use_orm(orm)
185
+ # :api: public
186
+ def use_orm(orm, &blk)
186
187
  begin
187
188
  Merb.orm = orm
188
189
  orm_plugin = "merb_#{orm}"
189
- Kernel.dependency(orm_plugin)
190
+ Kernel.dependency(orm_plugin, &blk)
190
191
  rescue LoadError => e
191
192
  Merb.logger.warn!("The #{orm_plugin} gem was not found. You may need to install it.")
192
193
  raise e
@@ -210,7 +211,7 @@ module Kernel
210
211
  # # This will now use the RSpec generator for tests
211
212
  # $ merb-gen model ActivityEvent
212
213
  #
213
- # @api public
214
+ # :api: public
214
215
  def use_testing_framework(test_framework, *test_dependencies)
215
216
  Merb.test_framework = test_framework
216
217
 
@@ -238,8 +239,8 @@ module Kernel
238
239
  # # This will now use haml templates in generators where available.
239
240
  # $ merb-gen resource_controller Project
240
241
  #
241
- # @api public
242
- def use_template_engine(template_engine)
242
+ # :api: public
243
+ def use_template_engine(template_engine, &blk)
243
244
  Merb.template_engine = template_engine
244
245
 
245
246
  if template_engine != :erb
@@ -248,7 +249,7 @@ module Kernel
248
249
  else
249
250
  template_engine_plugin = "merb_#{template_engine}"
250
251
  end
251
- Kernel.dependency(template_engine_plugin)
252
+ Kernel.dependency(template_engine_plugin, &blk)
252
253
  end
253
254
 
254
255
  nil
@@ -266,7 +267,7 @@ module Kernel
266
267
  # __caller_info__(1)
267
268
  # # => ['/usr/lib/ruby/1.8/irb/workspace.rb', '52', 'irb_binding']
268
269
  #
269
- # @api private
270
+ # :api: private
270
271
  def __caller_info__(i = 1)
271
272
  file, line, meth = caller[i].scan(/(.*?):(\d+):in `(.*?)'/).first
272
273
  end
@@ -291,7 +292,7 @@ module Kernel
291
292
  # [ 124, " @suspend_next = false", false ]
292
293
  # ]
293
294
  #
294
- # @api private
295
+ # :api: private
295
296
  def __caller_lines__(file, line, size = 4)
296
297
  line = line.to_i
297
298
  if file =~ /\(erubis\)/
@@ -344,7 +345,7 @@ module Kernel
344
345
  # total time to run, #puts won't appear in the profile report.
345
346
  # The code block will be run 30 times in the example above.
346
347
  #
347
- # @api private
348
+ # :api: private
348
349
  def __profile__(name, min=1, iter=100)
349
350
  require 'ruby-prof' unless defined?(RubyProf)
350
351
  return_result = ''
@@ -371,7 +372,7 @@ module Kernel
371
372
  # # [...]
372
373
  # end
373
374
  #
374
- # @api public
375
+ # :api: public
375
376
  def extract_options_from_args!(args)
376
377
  args.pop if Hash === args.last
377
378
  end
@@ -385,7 +386,7 @@ module Kernel
385
386
  # @raise <ArgumentError>
386
387
  # An object failed to quack like a condition.
387
388
  #
388
- # @api public
389
+ # :api: public
389
390
  def enforce!(opts = {})
390
391
  opts.each do |k,v|
391
392
  raise ArgumentError, "#{k.inspect} doesn't quack like #{v.inspect}" unless k.quacks_like?(v)
@@ -2,6 +2,7 @@ module Merb
2
2
 
3
3
  class Cookies < Mash
4
4
 
5
+ # :api: private
5
6
  def initialize(constructor = {})
6
7
  @_options_lookup = Mash.new
7
8
  @_cookie_defaults = { "domain" => Merb::Controller._default_cookie_domain, "path" => '/' }
@@ -17,6 +18,8 @@ module Merb
17
18
  # ==== Notes
18
19
  # By using this method, a cookie key is marked for being
19
20
  # included in the Set-Cookie response header.
21
+ #
22
+ # :api: public
20
23
  def []=(key, value)
21
24
  @_options_lookup[key] ||= {}
22
25
  super
@@ -38,6 +41,8 @@ module Merb
38
41
  # ==== Notes
39
42
  # By using this method, a cookie key is marked for being
40
43
  # included in the Set-Cookie response header.
44
+ #
45
+ # :api: private
41
46
  def set_cookie(name, value, options = {})
42
47
  @_options_lookup[name] = options
43
48
  self[name] = value
@@ -49,6 +54,8 @@ module Merb
49
54
  # ==== Parameters
50
55
  # name<~to_s>:: Name of the cookie to delete.
51
56
  # options<Hash>:: Additional options to pass to +set_cookie+.
57
+ #
58
+ # :api: public
52
59
  def delete(name, options = {})
53
60
  set_cookie(name, "", options.merge("expires" => Time.at(0)))
54
61
  end
@@ -57,6 +64,8 @@ module Merb
57
64
  #
58
65
  # ==== Returns
59
66
  # Hash:: The headers to set, or an empty array if no cookies are set.
67
+ #
68
+ # :api: private
60
69
  def extract_headers(controller_defaults = {})
61
70
  defaults = @_cookie_defaults.merge(controller_defaults)
62
71
  cookies = []
@@ -101,6 +110,8 @@ module Merb
101
110
  # ==== Notes
102
111
  # Headers are passed into the cookie object so that you can do:
103
112
  # cookies[:foo] = "bar"
113
+ #
114
+ # :api: public
104
115
  def cookies
105
116
  request.cookies
106
117
  end
@@ -114,6 +125,8 @@ module Merb
114
125
  # If a method #default_cookies is defined it will be called. This can
115
126
  # be used for session fixation purposes for example. The method returns
116
127
  # a Hash of key => value pairs.
128
+ #
129
+ # :api: public
117
130
  def cookies
118
131
  @cookies ||= begin
119
132
  values = Merb::Parse.query(@env[Merb::Const::HTTP_COOKIE], ';,')
@@ -1,10 +1,14 @@
1
1
  module Merb
2
2
  class Dispatcher
3
+ # :api: private
3
4
  module DefaultExceptionHelper
5
+
6
+ # :api: private
4
7
  def humanize_exception(e)
5
8
  e.class.name.split("::").last.gsub(/([a-z])([A-Z])/, '\1 \2')
6
9
  end
7
10
 
11
+ # :api: private
8
12
  def error_codes(exception)
9
13
  if @show_details
10
14
  message, message_details = exception.message.split("\n", 2)
@@ -14,6 +18,7 @@ module Merb
14
18
  end
15
19
  end
16
20
 
21
+ # :api: private
17
22
  def frame_details(line)
18
23
  filename, lineno, location = line.split(":")
19
24
  if filename.index(Merb.framework_root)
@@ -32,6 +37,7 @@ module Merb
32
37
  [type, shortname, filename, lineno, location]
33
38
  end
34
39
 
40
+ # :api: private
35
41
  def listing(key, value, arr)
36
42
  ret = []
37
43
  ret << "<table class=\"listing\" style=\"display: none\">"
@@ -51,10 +57,12 @@ module Merb
51
57
  ret.join("\n")
52
58
  end
53
59
 
60
+ # :api: private
54
61
  def textmate_url(filename, line)
55
62
  "<a href='txmt://open?url=file://#{filename}&amp;line=#{line}'>#{line}</a>"
56
63
  end
57
64
 
65
+ # :api: private
58
66
  def render_source(filename, line)
59
67
  line = line.to_i
60
68
  ret = []
@@ -76,13 +84,16 @@ module Merb
76
84
  end
77
85
  end
78
86
 
87
+ # :api: private
79
88
  class DefaultException < Merb::Controller
80
89
  self._template_root = File.dirname(__FILE__) / "views"
81
90
 
91
+ # :api: private
82
92
  def _template_location(context, type = nil, controller = controller_name)
83
93
  "#{context}.#{type}"
84
- end
94
+ end
85
95
 
96
+ # :api: private
86
97
  def index
87
98
  @exceptions = request.exceptions
88
99
  @show_details = Merb::Config[:exception_details]
@@ -5,6 +5,7 @@ module Merb
5
5
  class << self
6
6
  include Merb::ControllerExceptions
7
7
 
8
+ # :api: private
8
9
  attr_accessor :use_mutex
9
10
 
10
11
  @@work_queue = Queue.new
@@ -12,7 +13,7 @@ module Merb
12
13
  # ==== Returns
13
14
  # Queue:: the current queue of dispatch jobs.
14
15
  #
15
- # @api private
16
+ # :api: private
16
17
  def work_queue
17
18
  @@work_queue
18
19
  end
@@ -30,7 +31,7 @@ module Merb
30
31
  # Merb::Controller::
31
32
  # The Merb::Controller that was dispatched to
32
33
  #
33
- # @api private
34
+ # :api: private
34
35
  def handle(request)
35
36
  request.handle
36
37
  end
@@ -47,7 +48,7 @@ module Merb
47
48
  # ==== Returns
48
49
  # Merb::Controller:: the controller that handled the action dispatch.
49
50
  #
50
- # @api private
51
+ # :api: private
51
52
  def handle
52
53
  start = Time.now
53
54
  Merb.logger.info "Started request handling: #{start.to_s}"
@@ -91,7 +92,7 @@ module Merb
91
92
  # Merb::Controller::
92
93
  # The Merb::Controller that was dispatched to.
93
94
  #
94
- # @api private
95
+ # :api: private
95
96
  def dispatch_action(klass, action, status=200)
96
97
  # build controller
97
98
  controller = klass.new(self, status)
@@ -121,7 +122,7 @@ module Merb
121
122
  # Exceptions::
122
123
  # The Merb::Controller that was dispatched to.
123
124
  #
124
- # @api private
125
+ # :api: private
125
126
  def dispatch_exception(exception)
126
127
  if(exception.is_a?(Merb::ControllerExceptions::Base) &&
127
128
  !exception.is_a?(Merb::ControllerExceptions::ServerError))
@@ -3,8 +3,12 @@ require 'tempfile'
3
3
  module Merb
4
4
 
5
5
  class Request
6
- # def env def exceptions def route_params
7
- attr_accessor :env, :exceptions, :route
6
+
7
+ # :api: private
8
+ attr_accessor :env, :route
9
+ # :api: public
10
+ attr_accessor :exceptions
11
+ # :api: private
8
12
  attr_reader :route_params
9
13
 
10
14
  # by setting these to false, auto-parsing is disabled; this way you can
@@ -30,7 +34,7 @@ module Merb
30
34
  # http_request<~params:~[], ~body:IO>::
31
35
  # An object like an HTTP Request.
32
36
  #
33
- # @api private
37
+ # :api: private
34
38
  def initialize(rack_env)
35
39
  @env = rack_env
36
40
  @body = rack_env[Merb::Const::RACK_INPUT]
@@ -44,7 +48,7 @@ module Merb
44
48
  # Class:: The controller class matching the routed request,
45
49
  # e.g. Posts.
46
50
  #
47
- # @api private
51
+ # :api: private
48
52
  def controller
49
53
  unless params[:controller]
50
54
  raise ControllerExceptions::NotFound,
@@ -76,7 +80,7 @@ module Merb
76
80
  # The block will get the controller yielded to it. The first matching workaround wins.
77
81
  # To disable this behavior, set http_method_overrides = []
78
82
  #
79
- # @api public
83
+ # :api: public
80
84
  def method
81
85
  @method ||= begin
82
86
  request_method = @env[Merb::Const::REQUEST_METHOD].downcase.to_sym
@@ -107,7 +111,7 @@ module Merb
107
111
  # parameters (:action, :controller and named segments)
108
112
  # into request params hash.
109
113
  #
110
- # @api private
114
+ # :api: private
111
115
  def find_route!
112
116
  @route, @route_params = Merb::Router.route_for(self)
113
117
  params.merge! @route_params if @route_params.is_a?(Hash)
@@ -118,7 +122,7 @@ module Merb
118
122
  # and returns the current route params for the current
119
123
  # request evaluation
120
124
  #
121
- # @api private
125
+ # :api: private
122
126
  def _process_block_return(retval)
123
127
  # If the return value is an array, then it is a redirect
124
128
  # so we must set the request as a redirect and extract
@@ -131,14 +135,14 @@ module Merb
131
135
  # Sets the request as matched. This will abort evaluating any
132
136
  # further deferred procs.
133
137
  #
134
- # @api private
138
+ # :api: private
135
139
  def matched!
136
140
  @matched = true
137
141
  end
138
142
 
139
143
  # Checks whether or not the request has been matched to a route.
140
144
  #
141
- # @api private
145
+ # :api: private
142
146
  def matched?
143
147
  @matched
144
148
  end
@@ -151,7 +155,7 @@ module Merb
151
155
  # to be sent back as a response. Otherwise, the route_params is a Hash with
152
156
  # routing data (controller, action, et al).
153
157
  #
154
- # @api private
158
+ # :api: private
155
159
  def rack_response
156
160
  @route_params
157
161
  end
@@ -162,7 +166,7 @@ module Merb
162
166
  # ==== Returns
163
167
  # Boolean:: true if @route_params is an Array, false otherwise.
164
168
  #
165
- # @api private
169
+ # :api: private
166
170
  def handled?
167
171
  @route_params.is_a?(Array)
168
172
  end
@@ -177,7 +181,7 @@ module Merb
177
181
  # ==== Returns
178
182
  # Hash:: Parameters passed from the URL like ?blah=hello.
179
183
  #
180
- # @api private
184
+ # :api: private
181
185
  def query_params
182
186
  @query_params ||= Merb::Parse.query(query_string || '')
183
187
  end
@@ -188,7 +192,7 @@ module Merb
188
192
  # ==== Returns
189
193
  # Hash:: The parameters passed in the body.
190
194
  #
191
- # @api private
195
+ # :api: private
192
196
  def body_params
193
197
  @body_params ||= begin
194
198
  if content_type && content_type.match(Merb::Const::FORM_URL_ENCODED_REGEXP) # or content_type.nil?
@@ -202,7 +206,7 @@ module Merb
202
206
  # The parameters gathered from the query string and the request body,
203
207
  # with parameters in the body taking precedence.
204
208
  #
205
- # @api private
209
+ # :api: private
206
210
  def body_and_query_params
207
211
  # ^-- FIXME a better name for this method
208
212
  @body_and_query_params ||= begin
@@ -219,7 +223,7 @@ module Merb
219
223
  # ==== Returns
220
224
  # Hash:: The parsed multipart parameters.
221
225
  #
222
- # @api private
226
+ # :api: private
223
227
  def multipart_params
224
228
  @multipart_params ||=
225
229
  begin
@@ -245,7 +249,7 @@ module Merb
245
249
  # if it inflates to an Object) it will be accessible via the inflated_object
246
250
  # parameter.
247
251
  #
248
- # @api private
252
+ # :api: private
249
253
  def json_params
250
254
  @json_params ||= begin
251
255
  if Merb::Const::JSON_MIME_TYPE_REGEXP.match(content_type)
@@ -263,7 +267,7 @@ module Merb
263
267
  # ==== Returns
264
268
  # Hash:: Parameters from body if this is an XML request.
265
269
  #
266
- # @api private
270
+ # :api: private
267
271
  def xml_params
268
272
  @xml_params ||= begin
269
273
  if Merb::Const::XML_MIME_TYPE_REGEXP.match(content_type)
@@ -281,7 +285,7 @@ module Merb
281
285
  # The order of precedence for the params is XML, JSON, multipart, body and
282
286
  # request string.
283
287
  #
284
- # @api public
288
+ # :api: public
285
289
  def params
286
290
  @params ||= begin
287
291
  h = body_and_query_params.merge(route_params)
@@ -295,7 +299,7 @@ module Merb
295
299
  # ==== Returns
296
300
  # String:: Returns the redirect message Base64 unencoded.
297
301
  #
298
- # @api public
302
+ # :api: public
299
303
  def message
300
304
  return {} unless params[:_message]
301
305
  begin
@@ -308,7 +312,7 @@ module Merb
308
312
  # ==== Notes
309
313
  # Resets the params to a nil value.
310
314
  #
311
- # @api private
315
+ # :api: private
312
316
  def reset_params!
313
317
  @params = nil
314
318
  end
@@ -316,7 +320,7 @@ module Merb
316
320
  # ==== Returns
317
321
  # String:: The raw post.
318
322
  #
319
- # @api private
323
+ # :api: private
320
324
  def raw_post
321
325
  @body.rewind if @body.respond_to?(:rewind)
322
326
  @raw_post ||= @body.read
@@ -325,7 +329,7 @@ module Merb
325
329
  # ==== Returns
326
330
  # Boolean:: If the request is an XML HTTP request.
327
331
  #
328
- # @api public
332
+ # :api: public
329
333
  def xml_http_request?
330
334
  not Merb::Const::XML_HTTP_REQUEST_REGEXP.match(@env[Merb::Const::HTTP_X_REQUESTED_WITH]).nil?
331
335
  end
@@ -335,7 +339,7 @@ module Merb
335
339
  # ==== Returns
336
340
  # String:: The remote IP address.
337
341
  #
338
- # @api public
342
+ # :api: public
339
343
  def remote_ip
340
344
  return @env[Merb::Const::HTTP_CLIENT_IP] if @env.include?(Merb::Const::HTTP_CLIENT_IP)
341
345
 
@@ -355,7 +359,7 @@ module Merb
355
359
  # The protocol, i.e. either "https" or "http" depending on the
356
360
  # HTTPS header.
357
361
  #
358
- # @api public
362
+ # :api: public
359
363
  def protocol
360
364
  ssl? ? Merb::Const::HTTPS : Merb::Const::HTTP
361
365
  end
@@ -363,7 +367,7 @@ module Merb
363
367
  # ==== Returns
364
368
  # Boolean::: True if the request is an SSL request.
365
369
  #
366
- # @api public
370
+ # :api: public
367
371
  def ssl?
368
372
  @env[Merb::Const::UPCASE_HTTPS] == 'on' || @env[Merb::Const::HTTP_X_FORWARDED_PROTO] == Merb::Const::HTTPS
369
373
  end
@@ -371,7 +375,7 @@ module Merb
371
375
  # ==== Returns
372
376
  # String:: The HTTP referer.
373
377
  #
374
- # @api public
378
+ # :api: public
375
379
  def referer
376
380
  @env[Merb::Const::HTTP_REFERER]
377
381
  end
@@ -379,7 +383,7 @@ module Merb
379
383
  # ==== Returns
380
384
  # String:: The full URI, including protocol and host
381
385
  #
382
- # @api public
386
+ # :api: public
383
387
  def full_uri
384
388
  protocol + "://" + host + uri
385
389
  end
@@ -387,7 +391,7 @@ module Merb
387
391
  # ==== Returns
388
392
  # String:: The request URI.
389
393
  #
390
- # @api public
394
+ # :api: public
391
395
  def uri
392
396
  @env[Merb::Const::REQUEST_PATH] || @env[Merb::Const::REQUEST_URI] || path_info
393
397
  end
@@ -395,7 +399,7 @@ module Merb
395
399
  # ==== Returns
396
400
  # String:: The HTTP user agent.
397
401
  #
398
- # @api public
402
+ # :api: public
399
403
  def user_agent
400
404
  @env[Merb::Const::HTTP_USER_AGENT]
401
405
  end
@@ -403,7 +407,7 @@ module Merb
403
407
  # ==== Returns
404
408
  # String:: The server name.
405
409
  #
406
- # @api public
410
+ # :api: public
407
411
  def server_name
408
412
  @env[Merb::Const::SERVER_NAME]
409
413
  end
@@ -411,7 +415,7 @@ module Merb
411
415
  # ==== Returns
412
416
  # String:: The accepted encodings.
413
417
  #
414
- # @api private
418
+ # :api: private
415
419
  def accept_encoding
416
420
  @env[Merb::Const::HTTP_ACCEPT_ENCODING]
417
421
  end
@@ -419,7 +423,7 @@ module Merb
419
423
  # ==== Returns
420
424
  # String:: The script name.
421
425
  #
422
- # @api public
426
+ # :api: public
423
427
  def script_name
424
428
  @env[Merb::Const::SCRIPT_NAME]
425
429
  end
@@ -427,7 +431,7 @@ module Merb
427
431
  # ==== Returns
428
432
  # String:: HTTP cache control.
429
433
  #
430
- # @api public
434
+ # :api: public
431
435
  def cache_control
432
436
  @env[Merb::Const::HTTP_CACHE_CONTROL]
433
437
  end
@@ -435,7 +439,7 @@ module Merb
435
439
  # ==== Returns
436
440
  # String:: The accepted language.
437
441
  #
438
- # @api public
442
+ # :api: public
439
443
  def accept_language
440
444
  @env[Merb::Const::HTTP_ACCEPT_LANGUAGE]
441
445
  end
@@ -443,7 +447,7 @@ module Merb
443
447
  # ==== Returns
444
448
  # String:: The server software.
445
449
  #
446
- # @api public
450
+ # :api: public
447
451
  def server_software
448
452
  @env[Merb::Const::SERVER_SOFTWARE]
449
453
  end
@@ -451,7 +455,7 @@ module Merb
451
455
  # ==== Returns
452
456
  # String:: Value of HTTP_KEEP_ALIVE.
453
457
  #
454
- # @api public
458
+ # :api: public
455
459
  def keep_alive
456
460
  @env[Merb::Const::HTTP_KEEP_ALIVE]
457
461
  end
@@ -459,7 +463,7 @@ module Merb
459
463
  # ==== Returns
460
464
  # String:: The accepted character sets.
461
465
  #
462
- # @api public
466
+ # :api: public
463
467
  def accept_charset
464
468
  @env[Merb::Const::HTTP_ACCEPT_CHARSET]
465
469
  end
@@ -467,7 +471,7 @@ module Merb
467
471
  # ==== Returns
468
472
  # String:: The HTTP version
469
473
  #
470
- # @api private
474
+ # :api: private
471
475
  def version
472
476
  @env[Merb::Const::HTTP_VERSION]
473
477
  end
@@ -475,7 +479,7 @@ module Merb
475
479
  # ==== Returns
476
480
  # String:: The gateway.
477
481
  #
478
- # @api public
482
+ # :api: public
479
483
  def gateway
480
484
  @env[Merb::Const::GATEWAY_INTERFACE]
481
485
  end
@@ -483,7 +487,7 @@ module Merb
483
487
  # ==== Returns
484
488
  # String:: The accepted response types. Defaults to "*/*".
485
489
  #
486
- # @api private
490
+ # :api: private
487
491
  def accept
488
492
  @env[Merb::Const::HTTP_ACCEPT].blank? ? "*/*" : @env[Merb::Const::HTTP_ACCEPT]
489
493
  end
@@ -491,7 +495,7 @@ module Merb
491
495
  # ==== Returns
492
496
  # String:: The HTTP connection.
493
497
  #
494
- # @api private
498
+ # :api: private
495
499
  def connection
496
500
  @env[Merb::Const::HTTP_CONNECTION]
497
501
  end
@@ -499,7 +503,7 @@ module Merb
499
503
  # ==== Returns
500
504
  # String:: The query string.
501
505
  #
502
- # @api private
506
+ # :api: private
503
507
  def query_string
504
508
  @env[Merb::Const::QUERY_STRING]
505
509
  end
@@ -507,7 +511,7 @@ module Merb
507
511
  # ==== Returns
508
512
  # String:: The request content type.
509
513
  #
510
- # @api private
514
+ # :api: private
511
515
  def content_type
512
516
  @env[Merb::Const::UPCASE_CONTENT_TYPE]
513
517
  end
@@ -515,7 +519,7 @@ module Merb
515
519
  # ==== Returns
516
520
  # Fixnum:: The request content length.
517
521
  #
518
- # @api public
522
+ # :api: public
519
523
  def content_length
520
524
  @content_length ||= @env[Merb::Const::CONTENT_LENGTH].to_i
521
525
  end
@@ -525,7 +529,7 @@ module Merb
525
529
  # The URI without the query string. Strips trailing "/" and reduces
526
530
  # duplicate "/" to a single "/".
527
531
  #
528
- # @api public
532
+ # :api: public
529
533
  def path
530
534
  # Merb::Const::SLASH is /
531
535
  # Merb::Const::QUESTION_MARK is ?
@@ -537,7 +541,7 @@ module Merb
537
541
  # ==== Returns
538
542
  # String:: The path info.
539
543
  #
540
- # @api public
544
+ # :api: public
541
545
  def path_info
542
546
  @path_info ||= Merb::Parse.unescape(@env[Merb::Const::PATH_INFO])
543
547
  end
@@ -545,7 +549,7 @@ module Merb
545
549
  # ==== Returns
546
550
  # Fixnum:: The server port.
547
551
  #
548
- # @api public
552
+ # :api: public
549
553
  def port
550
554
  @env[Merb::Const::SERVER_PORT].to_i
551
555
  end
@@ -553,7 +557,7 @@ module Merb
553
557
  # ==== Returns
554
558
  # String:: The full hostname including the port.
555
559
  #
556
- # @api public
560
+ # :api: public
557
561
  def host
558
562
  @env[Merb::Const::HTTP_X_FORWARDED_HOST] || @env[Merb::Const::HTTP_HOST] ||
559
563
  @env[Merb::Const::SERVER_NAME]
@@ -567,7 +571,7 @@ module Merb
567
571
  # ==== Returns
568
572
  # Array:: All the subdomain parts of the host.
569
573
  #
570
- # @api public
574
+ # :api: public
571
575
  def subdomains(tld_length = 1)
572
576
  parts = host.split(Merb::Const::DOT)
573
577
  parts[0..-(tld_length+2)]
@@ -581,7 +585,7 @@ module Merb
581
585
  # ==== Returns
582
586
  # String:: The full domain name without the port number.
583
587
  #
584
- # @api public
588
+ # :api: public
585
589
  def domain(tld_length = 1)
586
590
  host.split(Merb::Const::DOT).last(1 + tld_length).join(Merb::Const::DOT).sub(/:\d+$/,'')
587
591
  end
@@ -589,7 +593,7 @@ module Merb
589
593
  # ==== Returns
590
594
  # Value of If-None-Match request header.
591
595
  #
592
- # @api private
596
+ # :api: private
593
597
  def if_none_match
594
598
  @env[Merb::Const::HTTP_IF_NONE_MATCH]
595
599
  end
@@ -597,7 +601,7 @@ module Merb
597
601
  # ==== Returns
598
602
  # Value of If-Modified-Since request header.
599
603
  #
600
- # @api private
604
+ # :api: private
601
605
  def if_modified_since
602
606
  if time = @env[Merb::Const::HTTP_IF_MODIFIED_SINCE]
603
607
  Time.rfc2822(time)