lib/tynn/all_methods.rb in tynn-1.0.0.rc3 vs lib/tynn/all_methods.rb in tynn-1.0.0
- old
+ new
@@ -1,15 +1,44 @@
class Tynn
+ # Public: Adds method for HTTP's +HEAD+ and +OPTIONS+.
+ #
+ # Examples
+ #
+ # require "tynn"
+ # require "tynn/all_methods"
+ #
+ # Tynn.helpers(Tynn::AllMethods)
+ #
module AllMethods
module InstanceMethods
+ # Public: Executes the given block if the request method is +HEAD+.
+ #
+ # Examples
+ #
+ # Tynn.define do
+ # head do
+ # res.status = 201
+ # end
+ # end
+ #
def head
if root? && req.head?
yield
halt(res.finish)
end
end
+ # Public: Executes the given block if the request method is +OPTIONS+.
+ #
+ # Examples
+ #
+ # Tynn.define do
+ # options do
+ # res.status = 405
+ # end
+ # end
+ #
def options
if root? && req.options?
yield
halt(res.finish)