Sha256: 4d6fc701ca876e3fe1ec6be9e5eb9e7771611c1fb22ba163d2f69815f7e2093c

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

require 'sinatra'
require 'securerandom'
class ApplicationController < Sinatra::Base
  if settings.methods(false).include?(:maintenance)
    if settings.maintenance
      define_singleton_method(:maintenance) do |&block|
        get '*', &block
        post '*', &block
        put '*', &block
        patch '*', &block
        delete '*', &block
        options '*', &block
        link '*', &block
        unlink '*', &block
      end
    else
      define_singleton_method(:maintenance) {|&block| get "/#{SecureRandom.random_bytes 16}", &block}
    end
  else
    define_singleton_method(:maintenance) {|&block| get "/#{SecureRandom.random_bytes 16}", &block}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eucalypt-0.5.2 lib/eucalypt/core/helpers/maintenance.rb