Method: Arrow::Config#reload

Defined in:
lib/arrow/config.rb

#reloadObject

Reload the configuration from the original source if it has changed. Returns true if it was reloaded and false otherwise.



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/arrow/config.rb', line 292

def reload
  return false unless @loader && @name

  # Even if reloading fails, reset the creation time so we don't keep
  # trying to reload a broken config
  self.create_time = Time.now

  confighash = @loader.load( @name )
  ihash = internify_keys( untaint_values(confighash) )
  mergedhash = DEFAULTS.merge( ihash, &HashMergeFunction )

  @struct = ConfigStruct.new( mergedhash )

rescue => err
  self.log.error "Error while trying to reload the config: %s" % err.message
  err.backtrace.each {|frame| self.log.debug "  " + frame }

  return false
else
  return true
end