Sha256: 6c106d57fe32c6315245499570ae6dd83a72c4fa11b4550c470506abdd4ee039
Contents?: true
Size: 758 Bytes
Versions: 1
Compression:
Stored size: 758 Bytes
Contents
require 'yaml' module TimedConfig class <<self attr_accessor :config def path @path || (defined?(Rails) ? "#{Rails.root}/config/timed_config.yml" : nil) end def path=(p) thread.stop rescue nil @path = p thread.run end def period @period || 60 end def period=(seconds) thread.stop rescue nil @period = seconds thread.run end def thread @thread ||= Thread.new do while true if TimedConfig.path && File.exists?(TimedConfig.path) TimedConfig.config = YAML::load(File.open(TimedConfig.path)) end sleep TimedConfig.period end end end TimedConfig.thread end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
timed_config-0.1.0 | lib/timed_config.rb |