Module: Roda::RodaPlugins::BridgetownServer::RequestMethods

Defined in:
bridgetown-core/lib/roda/plugins/bridgetown_server.rb

Instance Method Summary collapse

Instance Method Details

#bridgetownObject

Start up the Bridgetown routing system



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'bridgetown-core/lib/roda/plugins/bridgetown_server.rb', line 157

def bridgetown
  scope.initialize_bridgetown_context
  scope.initialize_bridgetown_root

  # Run the static file server
  ssg

  # There are two different code paths depending on if there's a site `base_path` configured
  if Bridgetown::Current.preloaded_configuration.base_path == "/"
    Bridgetown::Rack::Routes.load_all scope
    return
  end

  # Support custom base_path configurations
  on(Bridgetown::Current.preloaded_configuration.base_path.delete_prefix("/")) do
    Bridgetown::Rack::Routes.load_all scope
  end

  nil
end

#cookiesObject

Monkeypatch Roda/Rack’s Request object so it returns a hash which allows for symbol or dot access



152
153
154
# File 'bridgetown-core/lib/roda/plugins/bridgetown_server.rb', line 152

def cookies
  HashWithDotAccess::Hash.new(_previous_roda_cookies)
end