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



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'bridgetown-core/lib/roda/plugins/bridgetown_server.rb', line 155

def bridgetown
  scope.initialize_bridgetown_context
  scope.initialize_bridgetown_root

  base_path = Bridgetown::Current.preloaded_configuration.base_path.delete_prefix("/")

  if base_path.empty?
    ssg # static file server
    Bridgetown::Rack::Routes.load_all scope
  else
    on(base_path) do
      ssg # static file server
      Bridgetown::Rack::Routes.load_all scope
    end
  end
end

#cookiesObject

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



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

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