Class: Ddr::Auth::Affiliation Abstract

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/ddr/auth/affiliation.rb

Overview

This class is abstract.

Constant Summary collapse

VALUES =
[:faculty, :staff, :student, :emeritus, :affiliate, :alumni]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.allObject



23
24
25
# File 'lib/ddr/auth/affiliation.rb', line 23

def all
  @all ||= VALUES.map { |value| get(value) }
end

.get(affiliation) ⇒ Object



27
28
29
# File 'lib/ddr/auth/affiliation.rb', line 27

def get(affiliation)
  const_get(affiliation.to_s.capitalize)
end

.group(affiliation) ⇒ Object



31
32
33
# File 'lib/ddr/auth/affiliation.rb', line 31

def group(affiliation)
  get(affiliation).group
end

.groupsObject



35
36
37
# File 'lib/ddr/auth/affiliation.rb', line 35

def groups
  @groups ||= all.map(&:group)
end

Instance Method Details

#groupObject



14
15
16
# File 'lib/ddr/auth/affiliation.rb', line 14

def group
  Group.build("duke.#{self}")
end

#inspectObject



18
19
20
# File 'lib/ddr/auth/affiliation.rb', line 18

def inspect
  "#<#{self.class.name}(#{self})>"
end