Class: UcbGroups::Person
- Inherits:
-
Object
- Object
- UcbGroups::Person
- Includes:
- Comparable
- Defined in:
- lib/ucb_groups/person.rb
Constant Summary collapse
- ATTRIBUTE_MAPPINGS =
{ :uid => :uid, :first_name => :givenname, :last_name => :sn, :email => :mail, :orgs => :berkeleyEduPrimaryDeptUnitHierarchyString }.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other_person) ⇒ Object
- #eql?(other_person) ⇒ Boolean
- #full_name ⇒ Object
- #hash ⇒ Object
-
#initialize(ldap_entry) ⇒ Person
constructor
A new instance of Person.
Constructor Details
#initialize(ldap_entry) ⇒ Person
Returns a new instance of Person.
15 16 17 18 19 |
# File 'lib/ucb_groups/person.rb', line 15 def initialize(ldap_entry) ATTRIBUTE_MAPPINGS.each do |attr, val| self.send("#{attr}=", ldap_entry[val].first.to_s) if ldap_entry[val] end end |
Class Method Details
.ldap_attributes ⇒ Object
25 26 27 |
# File 'lib/ucb_groups/person.rb', line 25 def self.ldap_attributes @ldap_attributes ||= ATTRIBUTE_MAPPINGS.values.map(&:to_s) end |
Instance Method Details
#<=>(other_person) ⇒ Object
37 38 39 |
# File 'lib/ucb_groups/person.rb', line 37 def <=>(other_person) self.hash <=> other_person.hash end |
#eql?(other_person) ⇒ Boolean
29 30 31 |
# File 'lib/ucb_groups/person.rb', line 29 def eql?(other_person) self.hash == other_person.hash end |
#full_name ⇒ Object
21 22 23 |
# File 'lib/ucb_groups/person.rb', line 21 def full_name [first_name, last_name].join(" ") end |
#hash ⇒ Object
33 34 35 |
# File 'lib/ucb_groups/person.rb', line 33 def hash self.uid.to_i end |