Cleaning up (class << self; def meth; end; end) where I can
This commit is contained in:
parent
eef4cb3043
commit
dbdc13bf1f
|
@ -722,29 +722,26 @@ module Sinatra
|
|||
set :run, false
|
||||
set :reload, Proc.new { app_file? && development? }
|
||||
|
||||
@reloading = false
|
||||
|
||||
class << self
|
||||
def reloading?
|
||||
@reloading
|
||||
def self.reloading?
|
||||
@reloading ||= false
|
||||
end
|
||||
|
||||
def configure(*envs)
|
||||
def self.configure(*envs)
|
||||
super unless reloading?
|
||||
end
|
||||
|
||||
def call(env)
|
||||
def self.call(env)
|
||||
reload! if reload?
|
||||
super
|
||||
end
|
||||
|
||||
def reload!
|
||||
def self.reload!
|
||||
@reloading = true
|
||||
superclass.send :inherited, self
|
||||
::Kernel.load app_file
|
||||
@reloading = false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Application < Default
|
||||
|
|
Loading…
Reference in New Issue