Sha256: f0deeedbf76970d6fff9108149a7ce4eb69a77c2f2bded671088344545099f6a

Contents?: true

Size: 752 Bytes

Versions: 1

Compression:

Stored size: 752 Bytes

Contents

require "turbo/engine"

module Turbo
  extend ActiveSupport::Autoload

  mattr_accessor :draw_routes, default: true

  thread_mattr_accessor :current_request_id

  class << self
    attr_writer :signed_stream_verifier_key

    def signed_stream_verifier
      @signed_stream_verifier ||= ActiveSupport::MessageVerifier.new(signed_stream_verifier_key, digest: "SHA256", serializer: JSON)
    end

    def signed_stream_verifier_key
      @signed_stream_verifier_key or raise ArgumentError, "Turbo requires a signed_stream_verifier_key"
    end

    def with_request_id(request_id)
      old_request_id, self.current_request_id = self.current_request_id, request_id
      yield
    ensure
      self.current_request_id = old_request_id
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
turbo-rails-2.0.0.pre.beta.1 lib/turbo-rails.rb