class Adalog::Configuration

Constants

RequiredSettings
UntouchedValue

Public Class Methods

new() click to toggle source
# File lib/adalog/configuration.rb, line 10
def initialize
  defaults.each_pair do |attr, value|
    self.send("#{attr}=", value)
  end
end

Public Instance Methods

defaults() click to toggle source
# File lib/adalog/configuration.rb, line 17
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
validate!() click to toggle source
# File lib/adalog/configuration.rb, line 35
def validate!
  RequiredSettings.each do |required_attr|
    if UntouchedValue == self.send(required_attr)
      raise "Setting '#{required_attr}' for Adalog left unconfigured."
    end
  end
end
web_defaults() click to toggle source
# File lib/adalog/configuration.rb, line 27
def web_defaults
  { repo:         self.repo,
    time_format:  self.time_format,
    heading:      self.web_heading,
  }
end