aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/people_list.rb
blob: 2e4c7379221ee5be2c35011a73d68a89d8e10043 (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
# encoding: UTF-8
require 'log4r'
require 'mauve/calendar_interface'

module Mauve 

  # Stores a list of name.
  #
  # @author Yann Golanski
  class PeopleList < Struct.new(:label, :list)

    # Default contrustor.
    def initialize (*args)
      super(*args)
    end

    def label
      self[:label]
    end

    alias username label

    def list
      self[:list]
    end

    #
    # Set up the logger
    def logger
      @logger ||=  Log4r::Logger.new self.class
    end

    #
    # Return the array of people
    #
    def people
      list.collect do |name|
        Configuration.current.people.has_key?(name) ? Configuration.current.people[name] : nil
      end.reject{|person| person.nil?}
    end

  end

end