Module: CoverRage::Config
- Defined in:
- lib/cover_rage/config.rb
Class Method Summary collapse
Class Method Details
.disable? ⇒ Boolean
33 34 35 |
# File 'lib/cover_rage/config.rb', line 33 def self.disable? @disable ||= ENV.key?('COVER_RAGE_DISABLE') end |
.root_path ⇒ Object
6 7 8 |
# File 'lib/cover_rage/config.rb', line 6 def self.root_path @root_path ||= ENV.fetch('COVER_RAGE_ROOT_PATH', defined?(Rails) && Rails.root ? Rails.root.to_s : Dir.pwd) end |
.sleep_duration ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/cover_rage/config.rb', line 24 def self.sleep_duration @sleep_duration ||= begin args = ENV.fetch('COVER_RAGE_SLEEP_DURATION', '60:90').split(':').map!(&:to_i).first(2) args.push(args.first.succ) if args.length < 2 Range.new(*args, true) end end |
.store ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cover_rage/config.rb', line 10 def self.store @store ||= begin uri = URI.parse(ENV.fetch('COVER_RAGE_STORE_URL')) case uri.scheme when 'redis', 'rediss' require 'cover_rage/stores/redis' CoverRage::Stores::Redis.new(uri.to_s) when 'sqlite' require 'cover_rage/stores/sqlite' CoverRage::Stores::Sqlite.new(uri.path) end end end |