Module: Tynn::AllMethods::InstanceMethods

Defined in:
lib/tynn/all_methods.rb

Instance Method Summary collapse

Instance Method Details

#headObject

Public: Executes the given block if the request method is HEAD.

Examples

Tynn.define do
  head do
    res.status = 201
  end
end


23
24
25
26
27
28
29
# File 'lib/tynn/all_methods.rb', line 23

def head
  if root? && req.head?
    yield

    halt(res.finish)
  end
end

#optionsObject

Public: Executes the given block if the request method is OPTIONS.

Examples

Tynn.define do
  options do
    res.status = 405
  end
end


41
42
43
44
45
46
47
# File 'lib/tynn/all_methods.rb', line 41

def options
  if root? && req.options?
    yield

    halt(res.finish)
  end
end