Module: Fastr::Application::Handler

Defined in:
lib/fastr/application.rb

Instance Method Summary collapse

Instance Method Details

#file_modifiedObject



144
145
146
147
# File 'lib/fastr/application.rb', line 144

def file_modified
  app.log.debug "Reloading file: #{path}"
  reload(path)
end

#reload(path) ⇒ Object



149
150
151
152
153
154
155
156
157
# File 'lib/fastr/application.rb', line 149

def reload(path)
  filename = File.basename(path)

  # Is it a controller?
  match = /^((\w+)_controller).rb$/.match(filename)
  reload_controller(match[1]) if not match.nil?

  load(path)
end

#reload_controller(name) ⇒ Object



159
160
161
# File 'lib/fastr/application.rb', line 159

def reload_controller(name)
  Object.send(:remove_const, name.camelcase.to_sym)
end