Sha256: 681dd542acc1db7ae668f32a0df07dafe2c39f6f31c7fb20252d9fa7df21a53e
Contents?: true
Size: 942 Bytes
Versions: 3
Compression:
Stored size: 942 Bytes
Contents
module Adalog class Configuration RequiredSettings = [:repo, :singleton, :html_erb, :time_format, :web_heading].freeze UntouchedValue = Object.new.freeze attr_accessor *RequiredSettings def initialize defaults.each_pair do |attr, value| self.send("#{attr}=", value) end end def defaults { repo: Adalog::InMemoryRepo.new, singleton: true, html_erb: true, time_format: "%H:%M:%S - %d %b %Y", web_heading: "Stub Adapter Logs", } end def web_defaults { repo: self.repo, time_format: self.time_format, heading: self.web_heading, } end def validate! RequiredSettings.each do |required_attr| if UntouchedValue == self.send(required_attr) raise "Setting '#{required_attr}' for Adalog left unconfigured." end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
adalog-0.5.0 | lib/adalog/configuration.rb |
adalog-0.4.1 | lib/adalog/configuration.rb |
adalog-0.4.0 | lib/adalog/configuration.rb |