Sha256: 94b5d67f53f6f4ab22524792e65107a70f7abecbaee2b099db8454297117fc96

Contents?: true

Size: 692 Bytes

Versions: 2

Compression:

Stored size: 692 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 3.times.map{"/#{SecureRandom.hex 8}"}.join(), &block}
    end
  else
    define_singleton_method(:maintenance) {|&block| get 3.times.map{"/#{SecureRandom.hex 8}"}.join(), &block}
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eucalypt-0.5.4 lib/eucalypt/core/helpers/maintenance.rb
eucalypt-0.5.3 lib/eucalypt/core/helpers/maintenance.rb