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 :run, false
|
||||||
set :reload, Proc.new { app_file? && development? }
|
set :reload, Proc.new { app_file? && development? }
|
||||||
|
|
||||||
@reloading = false
|
def self.reloading?
|
||||||
|
@reloading ||= false
|
||||||
class << self
|
|
||||||
def reloading?
|
|
||||||
@reloading
|
|
||||||
end
|
|
||||||
|
|
||||||
def configure(*envs)
|
|
||||||
super unless reloading?
|
|
||||||
end
|
|
||||||
|
|
||||||
def call(env)
|
|
||||||
reload! if reload?
|
|
||||||
super
|
|
||||||
end
|
|
||||||
|
|
||||||
def reload!
|
|
||||||
@reloading = true
|
|
||||||
superclass.send :inherited, self
|
|
||||||
::Kernel.load app_file
|
|
||||||
@reloading = false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.configure(*envs)
|
||||||
|
super unless reloading?
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.call(env)
|
||||||
|
reload! if reload?
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.reload!
|
||||||
|
@reloading = true
|
||||||
|
superclass.send :inherited, self
|
||||||
|
::Kernel.load app_file
|
||||||
|
@reloading = false
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Application < Default
|
class Application < Default
|
||||||
|
|
Loading…
Reference in New Issue