Sha256: 337c0fc85652bbeb35b8e5a800998449923dae1f3017e786e8fa3e0b863fd1b6

Contents?: true

Size: 701 Bytes

Versions: 6

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

class Roda
  module RodaPlugins
    module BridgetownBoot
      Roda::RodaRequest.alias_method :_previous_roda_cookies, :cookies

      module RequestMethods
        # Monkeypatch Roda/Rack's Request object so it returns a hash which allows for
        # indifferent access
        def cookies
          # TODO: maybe replace with a simpler hash that offers an overloaded `[]` method
          _previous_roda_cookies.with_indifferent_access
        end

        # Starts up the Bridgetown routing system
        def bridgetown
          Bridgetown::Rack::Routes.start!(scope)
        end
      end
    end

    register_plugin :bridgetown_boot, BridgetownBoot
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bridgetown-core-1.2.0 lib/roda/plugins/bridgetown_boot.rb
bridgetown-core-1.2.0.beta5 lib/roda/plugins/bridgetown_boot.rb
bridgetown-core-1.2.0.beta4 lib/roda/plugins/bridgetown_boot.rb
bridgetown-core-1.2.0.beta3 lib/roda/plugins/bridgetown_boot.rb
bridgetown-core-1.2.0.beta2 lib/roda/plugins/bridgetown_boot.rb
bridgetown-core-1.2.0.beta1 lib/roda/plugins/bridgetown_boot.rb