Skip to content

Commit

Permalink
Cleaning up (class << self; def meth; end; end) where I can
Browse files Browse the repository at this point in the history
  • Loading branch information
bmizerany committed Jan 7, 2009
1 parent eef4cb3 commit dbdc13b
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions lib/sinatra/base.rb
Expand Up @@ -722,29 +722,26 @@ class Default < Base
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 end
def reloading?
@reloading
end


def configure(*envs) def self.configure(*envs)
super unless reloading? super unless reloading?
end end


def call(env) def self.call(env)
reload! if reload? reload! if reload?
super super
end end


def reload! def self.reload!
@reloading = true @reloading = true
superclass.send :inherited, self superclass.send :inherited, self
::Kernel.load app_file ::Kernel.load app_file
@reloading = false @reloading = false
end
end end

end end


class Application < Default class Application < Default
Expand Down

0 comments on commit dbdc13b

Please sign in to comment.