File: contrib.rb

package info (click to toggle)
ruby-sinatra 4.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,932 kB
  • sloc: ruby: 17,700; sh: 25; makefile: 8
file content (42 lines) | stat: -rw-r--r-- 1,289 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true

require 'sinatra/contrib/setup'

module Sinatra
  module Contrib
    ##
    # Common middleware that doesn't bring run time overhead if not used
    # or breaks if external dependencies are missing. Will extend
    # Sinatra::Application by default.
    module Common
      register :ConfigFile, 'sinatra/config_file'
      register :MultiRoute, 'sinatra/multi_route'
      register :Namespace, 'sinatra/namespace'
      register :RespondWith, 'sinatra/respond_with'

      helpers :Capture, 'sinatra/capture'
      helpers :ContentFor, 'sinatra/content_for'
      helpers :Cookies, 'sinatra/cookies'
      helpers :EngineTracking, 'sinatra/engine_tracking'
      helpers :JSON, 'sinatra/json'
      helpers :LinkHeader, 'sinatra/link_header'
      helpers :Streaming, 'sinatra/streaming'
      helpers :RequiredParams, 'sinatra/required_params'
    end

    ##
    # Other extensions you don't want to be loaded unless needed.
    module Custom
      register :Reloader, 'sinatra/reloader'

      helpers :HamlHelpers, 'sinatra/haml_helpers'
    end

    ##
    # Stuff that aren't Sinatra extensions, technically.
    autoload :Extension, 'sinatra/extension'
    autoload :TestHelpers, 'sinatra/test_helpers'
  end

  register Sinatra::Contrib::Common
end