aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/configuration.rb
blob: a74165b52ed44fe4e68d0559cf4dbcdfaee0a56c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
require 'mauve/source_list'
require 'mauve/people_list'
require 'mauve/mauve_time'

module Mauve

  # Configuration object for Mauve.  This is used as the context in
  # Mauve::ConfigurationBuilder.
  #
  class Configuration

    class << self
      # The current configuration
      # @param  [Mauve::Configuration]
      # @return [Mauve::Configuration]
      attr_accessor :current
    end

    # The Server instance
    # @return [Mauve::Server]
    attr_accessor :server

    # The last AlertGroup to be configured
    # @return [Mauve::AlertGroup]
    attr_accessor :last_alert_group

    # Notification methods
    # @return [Hash]
    attr_reader   :notification_methods

    # People
    # @return [Hash]
    attr_reader   :people
    
    # Alert groups
    # @return [Array]
    attr_reader   :alert_groups

    # People lists
    # @return [Hash]
    attr_reader   :people_lists

    # The source lists
    # @return [Hash]
    attr_reader   :source_lists

    #
    # Set up a base config.
    #
    def initialize
      @server = nil
      @last_alert_group = nil
      @notification_methods = {}
      @people = {}
      @people_lists = Hash.new{|h,k| h[k] = Mauve::PeopleList.new(k)}
      @source_lists = Hash.new{|h,k| h[k] = Mauve::SourceList.new(k)}
      @alert_groups = []
    end
    
  end
end