Cleaning up (class << self; def meth; end; end) where I can

This commit is contained in:
Blake Mizerany 2009-01-06 17:31:11 -08:00
parent eef4cb3043
commit dbdc13bf1f
1 changed files with 19 additions and 22 deletions

View File

@ -722,29 +722,26 @@ module Sinatra
set :run, false
set :reload, Proc.new { app_file? && development? }
@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
def self.reloading?
@reloading ||= false
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
class Application < Default