Module: Josef::Local

Included in:
Diff
Defined in:
lib/josef/local.rb

Instance Method Summary collapse

Instance Method Details

#exculued?(group_mail_address) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/josef/local.rb', line 21

def exculued?(group_mail_address)
  exculued_groups.include?(group_mail_address)
end

#exculued_groups(exculued_groups_file = nil) ⇒ Object



25
26
27
# File 'lib/josef/local.rb', line 25

def exculued_groups(exculued_groups_file = nil)
  @_exculued_groups ||= exculued_groups!(exculued_groups_file)
end

#exculued_groups!(exculued_groups_file) ⇒ Object



29
30
31
32
33
# File 'lib/josef/local.rb', line 29

def exculued_groups!(exculued_groups_file)
  return [] if exculued_groups_file.nil?

  YAML.load_file(exculued_groups_file).symbolize_keys[:exculued_groups]
end

#local(local_file = nil) ⇒ Object



6
7
8
# File 'lib/josef/local.rb', line 6

def local(local_file = nil)
  @_local ||= local!(local_file)
end

#local!(local_file) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/josef/local.rb', line 10

def local!(local_file)
  return [] if local_file.nil?

  local_groups = YAML.load_file(local_file).map{|h| h.deep_symbolize_keys}
  local_groups.each do | group |
    group[:members] = [] if group[:members].nil?
  end

  local_groups
end