Class: Bread::Reloader

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/bread/reloader.rb

Instance Method Summary collapse

Constructor Details

#initializeReloader



5
6
7
8
9
10
11
# File 'lib/bread/reloader.rb', line 5

def initialize
  @files   = Dir["#{Rails.root}/app/lib/bread/*"]
  @checker = ActiveSupport::FileUpdateChecker.new(@files) do
    @files.each { |f| load f }
    puts "  Bread has reloaded!".light_blue
  end
end

Instance Method Details

#reload!Object



13
14
15
# File 'lib/bread/reloader.rb', line 13

def reload!
  @checker.execute if updated?
end