Class: Bread::Reloader
- Inherits:
-
Object
- Object
- Bread::Reloader
- Includes:
- Singleton
- Defined in:
- lib/bread/reloader.rb
Instance Method Summary collapse
-
#initialize ⇒ Reloader
constructor
A new instance of Reloader.
- #reload! ⇒ Object
Constructor Details
#initialize ⇒ Reloader
Returns a new instance of Reloader.
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 |